September 01, 2014 [Issue 13415] New: '-inline' causes wrong enclosing scope pointer for nested function called from templated struct | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=13415 Issue ID: 13415 Summary: '-inline' causes wrong enclosing scope pointer for nested function called from templated struct Product: D Version: D2 Hardware: All OS: All Status: NEW Keywords: wrong-code Severity: critical Priority: P1 Component: DMD Assignee: nobody@puremagic.com Reporter: verylonglogin.reg@gmail.com 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; core.exception.AssertError@a.d(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. -- |
Copyright © 1999-2021 by the D Language Foundation