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.
Comment #2 by k.hara.pg — 2013-05-08T07:15:09Z
Comment #3 by github-bugzilla — 2013-05-13T17:46:13Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e61d989b600588269a91d0aaaff557890df7233d fix Issue 10047 - opDispatch instantiation failure should be gagged for UFCS https://github.com/D-Programming-Language/dmd/commit/6daf3cc2a595e053d0bede7d0cc264cc2eb704ce Merge pull request #1981 from 9rnsr/fix10047 [REG2.063a] Issue 10047 - opDispatch instantiation failure should be gagged for UFCS