Bug 12951 – Not all failures to compile opDispatch should be regarded as "field not found"

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2014-06-19T21:50:21Z
Last change time
2018-05-16T13:14:11Z
Keywords
diagnostic
Assigned to
No Owner
Creator
hsteoh

Comments

Comment #0 by hsteoh — 2014-06-19T21:50:21Z
CODE: ------ struct S { int x, y, z; } struct T { S impl; auto opDispatch(string field)() { return __traits(getMember, impl, feild); // N.B. this is a typo } } void main() { T t; auto x = t.x; } ------ Compiler output: ------ test.d(13): Error: no property 'x' for type 'T' ------ Changing "feild" to "field" fixes the problem. This is not good, because the diagnostic is completely unhelpful -- there is no indication that the compile error is caused by a typo in the implementation of opDispatch. I understand that sometimes it's useful for failure to compile opDispatch to be taken as declining field dispatch (if field=="w" then the above error message would be appropriate), but this makes it nigh impossible to debug opDispatch, since the real error message has been gagged. Is there a way to gag only "no property..." errors, but leave the other errors in opDispatch ungagged?
Comment #1 by simen.kjaras — 2018-05-16T13:14:11Z
*** This issue has been marked as a duplicate of issue 14145 ***