www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 8387] New: Semantic errors in opDispatch body are not reported

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: justin economicmodeling.com



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: -------
Jul 13 2012
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=8387




PDT ---
*** Issue 8547 has been marked as a duplicate of this issue. ***

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