Bug 4949 – ICE on invalid static if using value of 'this'

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Linux
Creation time
2010-09-27T10:29:00Z
Last change time
2015-06-09T05:10:37Z
Keywords
ice-on-invalid-code, patch
Assigned to
nobody
Creator
ibuclaw

Attachments

IDFilenameSummaryContent-TypeSize
777interpret.diffcatch functions returning CANT_INTEPRET_EXPtext/plain767

Comments

Comment #0 by ibuclaw — 2010-09-27T10:29:25Z
Created attachment 777 catch functions returning CANT_INTEPRET_EXP testcase: class A { bool delegate() dg; void B() { static if ( dg() ) should error graciously; } } Produces: ice.d(6): Error: value of 'this' is not known at compile time Segmentation fault (core dumped) Catching it in gdb, occurs in interpret.c at CallExp::interpret, around line 2720. A few assignments, no checking whether or not any returned EXP_CANT_INTERPRET. Currently rebuilding using the attached change...
Comment #1 by ibuclaw — 2010-09-27T10:38:40Z
Tested, I now get: ice.d(6): Error: value of 'this' is not known at compile time ice.d(6): Error: expression this.dg() is not constant or does not evaluate to a bool Which is correct, and fixes the ICE. Regards
Comment #2 by bugzilla — 2010-10-08T14:12:57Z