Bug 2843 – ICE(constfold.c) with is-expression with invalid dot-expression in is-expression involving typeid expression

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-04-16T18:44:00Z
Last change time
2015-06-09T01:18:02Z
Keywords
ice-on-invalid-code, patch
Assigned to
bugzilla
Creator
dhasenan

Comments

Comment #0 by dhasenan — 2009-04-16T18:44:41Z
foo.bar is typeid(int); Error message: bug.d(3): Error: undefined identifier foo bug.d(3): Error: no property 'bar' for type 'int' bug.d(3): Error: incompatible types for ((1) is (&_D10TypeInfo_i6__initZ)): 'int' and 'object.TypeInfo' bug.d(3): Error: is has no effect in expression (1 is &_D10TypeInfo_i6__initZ) dmd: constfold.c:863: Expression* Identity(TOK, Type*, Expression*, Expression*): Assertion `0' failed. Aborted Thankfully, it gives you the full error message first.
Comment #1 by clugdbug — 2009-05-05T10:43:09Z
Reduced test case: bool b = 1 is typeid(int); This has the same root cause as 1524 (only cases where both are the same type were considered), but it's the case where one expression is a typeid, and the other is const. In constfold.c, line 861: OLD: }else assert(0); NEW: }else if (e1->isConst() && e2->isConst()) { // Comparing a SymExp with a literal, eg typeid(int) is 7.1; cmp=0; // An error has already occured. Prevent an ICE. }else assert(0);
Comment #2 by bugzilla — 2009-07-09T02:47:54Z
Fixed dmd 1.046 and 2.031