www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21622] New: pragma(crt_constructor) accepts functions that

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

          Issue ID: 21622
           Summary: pragma(crt_constructor) accepts functions that return
                    non-POD types
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

Returning types with destructors or that require hidden pointers to the return
type is obviously going to fail, but is accepted by the compiler.

    struct S { ~this(); }
    extern (C)
    pragma(crt_constructor) S foo() { return S(); } // should not compile

--
Feb 09 2021