Bug 24317 – pragma(inline, true) is wrongly applied when having nested functions

Status
NEW
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2024-01-03T21:18:29Z
Last change time
2024-12-13T19:32:22Z
Assigned to
No Owner
Creator
Marcelo Silva Nascimento Mancini
Moved to GitHub: dmd#20375 →

Comments

Comment #0 by msnmancini — 2024-01-03T21:18:29Z
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
Comment #1 by robert.schadek — 2024-12-13T19:32:22Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20375 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB