Bug 13612 – Wrong 'this' variable accessed in recursive ctfe member function
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-10-13T18:12:00Z
Last change time
2015-06-17T21:01:30Z
Keywords
CTFE, pull, wrong-code
Assigned to
nobody
Creator
yebblies
Comments
Comment #0 by yebblies — 2014-10-13T18:12:30Z
class S
{
int x;
int recurse()
{
S s;
assert(!x); // Error: class 'this' is null and cannot be dereferenced
s = new S();
return s.recurse();
}
}
static assert(new S().recurse());
In the interpreter's visit(ThisExp), the first branch for localThis is not taken because localThis is a VarExp, not a StructLiteralExp.