Issue 8387 - Semantic errors in opDispatch body are not reported
Summary: Semantic errors in opDispatch body are not reported
Status: RESOLVED DUPLICATE of issue 14145
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords:
: 8097 8547 10546 10760 (view as issue list)
Depends on:
Blocks:
 
Reported: 2012-07-13 15:16 UTC by Justin Whear
Modified: 2018-05-16 16:46 UTC (History)
7 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Justin Whear 2012-07-13 15:16:11 UTC
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 daniel 2012-09-22 03:24:53 UTC
*** Issue 8547 has been marked as a duplicate of this issue. ***
Comment 2 yebblies 2013-11-16 21:06:38 UTC
*** Issue 10546 has been marked as a duplicate of this issue. ***
Comment 3 yebblies 2013-11-16 21:06:40 UTC
*** Issue 10760 has been marked as a duplicate of this issue. ***
Comment 4 yebblies 2013-11-16 21:08:52 UTC
*** Issue 8097 has been marked as a duplicate of this issue. ***
Comment 5 Simen Kjaeraas 2018-05-16 13:28:25 UTC

*** This issue has been marked as a duplicate of issue 14145 ***