digitalmars.D.bugs - [Issue 24317] New: pragma(inline, true) is wrongly applied when
- d-bugmail puremagic.com (82/82) Jan 03 https://issues.dlang.org/show_bug.cgi?id=24317
https://issues.dlang.org/show_bug.cgi?id=24317 Issue ID: 24317 Summary: pragma(inline, true) is wrongly applied when having nested functions Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: msnmancini hotmail.com The following code: ```d pragma(inline, true) void test() { writeln(5); writeln("oops"); } pragma(inline, true) void test2() { static int abc(int a){return a;} writeln(abc(5)); writeln("oops"); } void test3() { pragma(inline, true) static int abc(int a){return a;} writeln(abc(5)); writeln("oops"); } void main() { test(); test2(); test3(); } ``` Generates this tree when looking at the AST: ```d pragma (inline, true)void test() { writeln(5); writeln("oops"); } pragma (inline, true)void test2() { static pure nothrow nogc safe int abc(int a) { return a; } writeln(((int a = 5;) , a)); writeln("oops"); } void test3() { static pure nothrow nogc safe int abc(int a) { return a; } writeln(abc(5)); writeln("oops"); } void main() { { writeln(5); writeln("oops"); } test2(); test3(); } ``` When I define a function inside it but I'm using pragma(inline), it actually inlines the function defined inside it. When I don't, it correctly inlines. But when I put it inside the function defined, it completely disappears! - https://issues.dlang.org/show_bug.cgi?id=23520 related --
Jan 03