https://issues.dlang.org/show_bug.cgi?id=19153
Issue ID: 19153 Summary: Symbol Undefined for mixin'd pragma(crt_constructor) on nested function Product: D Version: D2 Hardware: x86 OS: Windows Status: NEW Keywords: accepts-invalid, diagnostic, link-failure Severity: normal Priority: P1 Component: dmd Assignee: nob...@puremagic.com Reporter: simen.kja...@gmail.com template G(){ extern(C) pragma(crt_constructor) void init(){} } void main(){ mixin G!(); // Line 5 init(); } The above program compiles fine, but fails to link (Symbol Undefined __D3foo4mainFZ8__mixin14initMFNaNbNiNfZv). The issue is pragma(crt_constructor) is invalid for nested functions, and this is not reported when the function is introduced in a mixin. Expected behavior: Line 5 gives an error as if it introduced a regular nested function marked pragma(crt_constructor) - that is: Error: unrecognized pragma(crt_constructor) --