www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16360] New: DMD fails to inline functions that contain a type

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

          Issue ID: 16360
           Summary: DMD fails to inline functions that contain a type
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

When a simple type is nested in the function, e.g as an helper DMD fails to
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
--
Aug 07 2016