Bug 14917 – typeid(x) is typeid(y) returns different results during ctfe

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-08-13T13:50:00Z
Last change time
2015-08-14T04:52:30Z
Keywords
CTFE
Assigned to
nobody
Creator
joeyemmons

Comments

Comment #0 by joeyemmons — 2015-08-13T13:50:13Z
void main() { class A{} class B:A {} bool test(A a) { if(typeid(a) is typeid(B)) return true; return false; } bool rt = test(new B()); // TRUE enum ct = test(new B()); // FALSE assert(rt == ct); // FAILS }
Comment #1 by k.hara.pg — 2015-08-14T04:52:30Z
The code fails with 2.067, but succeeds with 2.068. I think some CTFE interpreter improvements had fortunately fixed this bug.