[Issue 8387] New: Semantic errors in opDispatch body are not reported

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jul 13 15:16:13 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8387

           Summary: Semantic errors in opDispatch body are not reported
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: justin at economicmodeling.com


--- Comment #0 from Justin Whear <justin at economicmodeling.com> 2012-07-13 15:16:11 PDT ---
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.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list