https://issues.dlang.org/show_bug.cgi?id=23520

RazvanN <razvan.nitu1...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1...@gmail.com> ---
It seems that the compiler has PragmaDeclaration and PragmaStatement to
differentiate between pragmas that are declared at module/aggregate level and
pragmas that are declared in function bodies. If you have any kind of pragma
that is inside a function body it will then be seen as a pragma statement,
irrespective of the fact that it is attached to a single declaration or to a
block of statements.

I see 2 ways of fixing this:

1. We can implement the expected behavior by attaching the pragma to the
declaration, but given the existing machinery in the compiler this will require
a lot of rework to transform the existing pragma statement into a pragma
declaration and hook in to the existing implementation.

2. Simply deprecate using pragma(inline) statements attached to declarations at
statement level. The online pragma that should be allowed at statement level is
`pragma(inline, expression);` In the case provided in the bug report you can
simply move the pragma(inline) inside the noinline function and it will work.
This has the advantage of keeping the implementation simple.

I would lean towards the second resolution as it keeps things simple. What do
you think Iain?

--

Reply via email to