Bug 10047 – opDispatch instantiation failure should be gagged for UFCS
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-05-08T06:26:00Z
Last change time
2013-05-13T17:46:29Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
zan77137
Comments
Comment #0 by zan77137 — 2013-05-08T06:26:35Z
This code doesn't work:
----------
//import std.typecons;
struct Typedef(T){
T a;
template opDispatch(string name) {
static if (__traits(getOverloads, a, name).length != 0) { }
}
}
struct A {}
void foo(Typedef!A a) {}
void main()
{
Typedef!A a;
a.foo();
}
-----------
$ dmd -run main
main.d(5): Error: function main.foo (Typedef!(A) a) is not callable using argume
nt types (A)
main.d(5): Error: a.foo cannot be resolved
main.d(14): Error: template instance main.Typedef!(A).Typedef.opDispatch!("foo")
error instantiating
main.d(14): Error: function expected before (), not a.(__error) of type _error_
-----------
git bisect result:
5d7ccff11d5bc91824bda7b66edca6318742f80b is the first bad commit
Comment #1 by k.hara.pg — 2013-05-08T06:58:07Z
Reduced test case.
struct Typedef(T)
{
template opDispatch(string name)
{
static assert(0);
}
}
struct A {}
void foo(Typedef!A a) { assert(0); }
void main()
{
Typedef!A a;
a.foo();
}
For the later UFCS name lookup, the errors in opDispatch instantiation should be gagged.