www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19153] New: Symbol Undefined for mixin'd


          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: nobody puremagic.com
          Reporter: simen.kjaras gmail.com

template G(){
    extern(C) pragma(crt_constructor) void init(){}
void main(){
    mixin G!(); // Line 5

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)

Aug 10 2018