<p dir="ltr">On 28 May 2015 04:15, "Mike via D.gnu" <<a href="mailto:d.gnu@puremagic.com">d.gnu@puremagic.com</a>> wrote:<br>
><br>
> Consider this code<br>
><br>
> testInline.d<br>
> ************<br>
> module testInline;<br>
><br>
> import gcc.attribute;<br>
><br>
> public enum inline = gcc.attribute.attribute("forceinline");<br>
><br>
> @inline int add(int a, int b)<br>
> {<br>
>     return a + b;<br>
> }<br>
><br>
> test.d<br>
> ******<br>
> import std.stdio;<br>
><br>
> import testInline;<br>
><br>
> void main()<br>
> {<br>
>     writeln(add(1, 2));<br>
> }<br>
><br>
> Compiler Output<br>
> ***************<br>
> gdc test.d<br>
> test.d: In function 'D main':<br>
> testInline.d:7:13: error: inlining failed in call to always_inline 'add': function body not available<br>
>  @inline int add(int a, int b)<br>
>              ^<br>
> test.d:8:5: error: called from here<br>
>      writeln(add(1, 2));<br>
>      ^<br>
><br>
><br>
> Shouldn't it be able to inline the "add" function since the source code is there in the testInline.d file?  Should I file a bug?<br>
></p>
<p dir="ltr">It's well known that cross-module inlining doesn't work for separate compilation.  Only option is to compile all sources in one go.</p>
<p dir="ltr">Isin<br>
</p>