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.
Comment #1 by henning — 2013-08-08T18:48:34Z
Comment #2 by github-bugzilla — 2013-08-09T03:44:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/50d719a0fdf2594b08d50980f623abc2f0d870ba fix issue 10783 - ICE and bad diagnostics when using non-existent symbols in switch and with statements https://github.com/D-Programming-Language/dmd/commit/52cc28752a6fd01446fd09a7ab9bd9f94ea601d2 Merge pull request #2457 from hpohl/10783 fix issue 10783 - ICE and bad diagnostics when using non-existent symbols in switch and with statements