[Issue 16360] DMD fails to inline functions that contain a type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 27 08:59:47 UTC 2018


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

--- Comment #4 from Basile B. <b2.temp at gmx.com> ---
(In reply to Basile B. from comment #0)
> When a simple type is nested in the function, e.g as an helper DMD fails to
> inline:
> 
> °°°°°°°°°°°°°°°°°°°°°°°°°°°°
> #!runnable-flags: -O -inline
> module runnable;
> 
> import std.stdio;
> 
> pragma(inline, true)
> auto foo(int t)
> {
>     struct Bar{}
>     return t;
> }
> 
> void main()
> {
>     auto v = foo(1);
> }
> °°°°°°°°°°°°°°°°°°°°°°°°°°°°
> 
> outputs:
> > /tmp/temp_7FD0A006D9F0.d(7,6): Error: function runnable.foo cannot inline function

Note :

1. this also fails if Bar is a nested static struct, which is more surprising.
2. this case is suspected to be part of the perf problem DMD has with ranges
and pipelines (Voldemort types are often nested...)

--


More information about the Digitalmars-d-bugs mailing list