Bug 10783 – ICE and bad diagnostics when using non-existent symbols in switch and with statements
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-08T14:21:00Z
Last change time
2013-08-09T03:45:07Z
Keywords
ice, pull
Assigned to
nobody
Creator
andrej.mitrovich
Comments
Comment #0 by andrej.mitrovich — 2013-08-08T14:21:28Z
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.