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.
Comment #1 by k.hara.pg — 2015-03-01T01:12:32Z
It's fixed in 2.067 git-head. Adding test case: https://github.com/D-Programming-Language/dmd/pull/4449
Comment #2 by github-bugzilla — 2015-03-01T02:08:04Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a91d0b3166229de8e243381c00650e09ad85f206 fix Issue 13612 - Wrong 'this' variable accessed in recursive ctfe member function https://github.com/D-Programming-Language/dmd/commit/c4d5b62bd9d6efe170171133bd96a8c0cfdbb50b Merge pull request #4449 from 9rnsr/fix13612 Issue 13612 - Wrong 'this' variable accessed in recursive ctfe member function
Comment #3 by github-bugzilla — 2015-06-17T21:01:30Z
Commits pushed to stable at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/a91d0b3166229de8e243381c00650e09ad85f206 fix Issue 13612 - Wrong 'this' variable accessed in recursive ctfe member function https://github.com/D-Programming-Language/dmd/commit/c4d5b62bd9d6efe170171133bd96a8c0cfdbb50b Merge pull request #4449 from 9rnsr/fix13612