www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19375] New: .init of a nested struct stumps the inliner

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

          Issue ID: 19375
           Summary: .init of a nested struct stumps the inliner
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: stanislav.blinov gmail.com

union Erase(T) { T typed; }

void func(T)() {
    pragma(inline, true);
    auto e = Erase!T(T.init);
}

void main() {
    version (TestNested) {
        struct S { ~this() {} /* so that it's nested */ }
    } else {
        static struct S { ~this() {} }
    }
    func!S;
}

$ dmd -inline test.d
Compiles

$ dmd -inline -version=TestNested test.d
test.d(3): Error: function `test.func!(S).func` cannot inline function

--
Nov 07 2018