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

D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 4949 - ICE on invalid static if using value of 'this'
Summary: ICE on invalid static if using value of 'this'
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: Other Linux
: P2 normal
Assignee: No Owner
URL:
Keywords: ice-on-invalid-code, patch
Depends on:
Blocks:
Reported: 2010年09月27日 10:29 UTC by Iain Buclaw
Modified: 2015年06月09日 05:10 UTC (History)
2 users (show)

See Also:


Attachments
catch functions returning CANT_INTEPRET_EXP (767 bytes, patch)
2010年09月27日 10:29 UTC, Iain Buclaw
Details | Diff
Add an attachment (proposed patch, testcase, etc.)

Note You need to log in before you can comment on or make changes to this issue.
Description Iain Buclaw 2010年09月27日 10:29:25 UTC
Created attachment 777 [details] 
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 Iain Buclaw 2010年09月27日 10:38:40 UTC
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 Walter Bright 2010年10月08日 14:12:57 UTC
http://www.dsource.org/projects/dmd/changeset/710 


AltStyle によって変換されたページ (->オリジナル) /