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)
Comment #1 by bugzilla — 2022-12-03T01:52:14Z
I cannot reproduce that. It compiles and links fine with master.