[Issue 13612] New: Wrong 'this' variable accessed in recursive ctfe member function
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Mon Oct 13 11:12:30 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13612
Issue ID: 13612
Summary: Wrong 'this' variable accessed in recursive ctfe
member function
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: CTFE, wrong-code
Severity: major
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: yebblies at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list