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