Bug 14406 – [REG2.068a] GIT HEAD ignores forward reference and generates wrong code

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-04-05T01:11:00Z
Last change time
2015-06-17T21:04:20Z
Keywords
accepts-invalid, pull, wrong-code
Assigned to
nobody
Creator
puneet

Comments

Comment #0 by puneet — 2015-04-05T01:11:42Z
Reduced test. // assertion fails -- both bar_obj and foo should be null though class Foo {} string str_mixin(T)() { alias P = Poo!T; return "Bar bar_obj; static class Bar { Foo foo; }"; } template Poo(T) { static if(T.tupleof.length) {}; } class Frop { mixin(str_mixin!(typeof(this))); } void main() { Frop simple = new Frop; assert(simple.bar_obj.foo is null, "foo is not null"); }
Comment #1 by puneet — 2015-04-05T01:13:41Z
2.067-rc1 does not compile the code. Regression only for GIT HEAD.
Comment #2 by k.hara.pg — 2015-04-05T03:20:59Z
This is an accepts-invalid bug. Slightly reduced: class Foo {} string str_mixin(T)() { static if (T.tupleof.length) {} // Fix instance size of T (== Frop) return "Bar bar_obj; static class Bar { Foo foo; }"; } class Frop { mixin(str_mixin!(typeof(this))); // adding more field after Frop fields fixed. } void main() { Frop simple = new Frop; } In str_mixin() function, testing Frop.tupleof fix the class fields and instance size. Therefore adding one more field `bar_obj` should be rejected because it will change the Frop instance size.
Comment #3 by k.hara.pg — 2015-04-05T03:49:02Z
Comment #4 by puneet — 2015-04-05T06:09:27Z
Thanks Kanji.. Works for me.
Comment #5 by github-bugzilla — 2015-04-06T20:03:52Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/4d91f33111d54ed09b9275b48bd65d243a3e3f05 fix Issue 14406 - GIT HEAD ignores forward reference and generates wrong code https://github.com/D-Programming-Language/dmd/commit/3b485c3279832a98be652e23ce27cb10e4c7abe2 Merge pull request #4556 from 9rnsr/fix14406 [REG2.068a] Issue 14406 - GIT HEAD ignores forward reference and generates wrong code
Comment #6 by puneet — 2015-05-05T18:23:08Z
Kenji Issue https://issues.dlang.org/show_bug.cgi?id=14549 might be related. Kindly have a look. Regards - Puneet
Comment #7 by github-bugzilla — 2015-06-17T21:04:20Z