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
Comment #1 by pro.mathias.lang — 2021-02-09T09:46:19Z
Shouldn't it just return nothing ? While there's no reason to prevent returning an `int`, there's no reason to allow it, either.
Comment #2 by robert.schadek — 2024-12-13T19:14:35Z