Bug 8387 – Semantic errors in opDispatch body are not reported

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-07-13T15:16:11Z
Last change time
2018-05-16T16:46:19Z
Assigned to
No Owner
Creator
Justin Whear
See also
http://d.puremagic.com/issues/show_bug.cgi?id=8547

Comments

Comment #0 by justin — 2012-07-13T15:16:11Z
If an opDispatch function has a semantic error inside the body a misleading error will be reported at the call site. Example: --------------------test.d---------------------- struct Foo { int opDispatch(string prop)() @property { pragma(msg, prop); thisFunctionDoesntExist(); return 1; } } void main() { import std.stdio; Foo bar; writeln(bar.baz); } ------------------------------------------------- Run: dmd test.d && ./test baz test.d(15): Error: undefined identifier 'baz' The pragma clearly shows that opDispatch template is being instantiated, but it seems to bail when an error is encountered, leading to the "undefined identifier" error.
Comment #1 by daniel350 — 2012-09-22T03:24:53Z
*** Issue 8547 has been marked as a duplicate of this issue. ***
Comment #2 by yebblies — 2013-11-16T21:06:38Z
*** Issue 10546 has been marked as a duplicate of this issue. ***
Comment #3 by yebblies — 2013-11-16T21:06:40Z
*** Issue 10760 has been marked as a duplicate of this issue. ***
Comment #4 by yebblies — 2013-11-16T21:08:52Z
*** Issue 8097 has been marked as a duplicate of this issue. ***
Comment #5 by simen.kjaras — 2018-05-16T13:28:25Z
*** This issue has been marked as a duplicate of issue 14145 ***