[Issue 10783] New: ICE and bad diagnostics when using non-existent symbols in switch and with statements

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Aug 8 14:21:30 PDT 2013


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

           Summary: ICE and bad diagnostics when using non-existent
                    symbols in switch and with statements
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-08 14:21:28 PDT ---
The code attempts to read a non-existent field, and also attempts to use a with
statement on a symbol that doesn't exist (usually an enum would be used)

-----
struct Event { }

void main()
{
    Event event;
    switch (event.type) with (En)
    {
        default:
    }
}
-----

test.d(8): Error: no property 'type' for type 'Event'
test.d(8): Error: '__error' must be of integral or string type, it is a _error_
test.d(8): Error: undefined identifier En
test.d(8): Deprecation: non-final switch statement without a default is
deprecated

After the errors DMD crashes. It's also interesting that the non-final switch
error occurred, even though there is actually a default switch in the code. The
__error's in the diagnostics should likely not show up to the user as well.

-- 
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