Bug 19153 – Symbol Undefined for mixin'd pragma(crt_constructor) on nested function

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-08-10T10:24:31Z
Last change time
2022-12-03T01:52:14Z
Keywords
accepts-invalid, diagnostic, link-failure
Assigned to
No Owner
Creator
Simen Kjaeraas
See also
https://issues.dlang.org/show_bug.cgi?id=23535

Comments

Comment #0 by simen.kjaras — 2018-08-10T10:24:31Z
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.