Bug 13415 – [REG2.066] '-inline' causes wrong enclosing scope pointer for nested function called from templated struct

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-09-01T18:56:00Z
Last change time
2014-09-04T13:50:56Z
Keywords
pull, wrong-code
Assigned to
nobody
Creator
verylonglogin.reg

Comments

Comment #0 by verylonglogin.reg — 2014-09-01T18:56:22Z
This code should run fine: a.d: --- struct S(alias func) { void call() { func(); } } extern(C) int printf(in char*, ...); void f(int i = 77) { void g() { printf("i = %d;\n", i); assert(i == 77); } S!g().call(); } --- main.d: --- import a; void main() { f(); } --- Command line (Windows): --- dmd -c a.d dmd main.d a.obj -inline -allinst main --- Output: --- i = 0; [email protected](10): Assertion failure ... --- `a` module compilation option doesn't matter. Final executable have to be compiled with '-inline' and either '-allinst' or '-debug'. This may be a root issue for reports Issue 13083, Issue 13244, and Issue 13286.
Comment #1 by k.hara.pg — 2014-09-02T02:44:33Z
(In reply to Denis Shelomovskij from comment #0) > `a` module compilation option doesn't matter. Final executable have to be > compiled with '-inline' and either '-allinst' or '-debug'. It would be a regression in 2.066, so the issue does not reproduce with 2.065.
Comment #2 by k.hara.pg — 2014-09-02T03:02:28Z
Comment #3 by github-bugzilla — 2014-09-03T01:04:46Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/e5e8a4ad6b0f9cd7a0bf979c701fe4ff223ffd7c fix Issue 13415 - '-inline' causes wrong enclosing scope pointer for nested function called from templated struct https://github.com/D-Programming-Language/dmd/commit/2c65f36934643eb5c56dffbea1b213e7a1113ad8 Merge pull request #3942 from 9rnsr/fix13415 [REG2.066] Issue 13415 - '-inline' causes wrong enclosing scope pointer for nested function called from templated struct
Comment #4 by github-bugzilla — 2014-09-04T13:50:56Z
Commit pushed to 2.066 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/50392a446e7cff03d68edcaed8d472b1772566f5 Merge pull request #3942 from 9rnsr/fix13415 [REG2.066] Issue 13415 - '-inline' causes wrong enclosing scope pointer for nested function called from templated struct