[Issue 15843] New: D-type mangling used for extern(C) (extern) function declaration inside function body, on LDC, GDC, and DMD.
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon Mar 28 09:32:00 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=15843
          Issue ID: 15843
           Summary: D-type mangling used for extern(C) (extern) function
                    declaration inside function body, on LDC, GDC, and
                    DMD.
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: lasssafin at gmail.com
Code:
void main() {
        extern(C) extern int func(int);
        static assert(func.mangleof == "_D1x4mainFZ4funcUiZi");
}
It is mangled as such on all 3 major compilers.
Using "pragma(mangle, "func")" as an attribute for func gives:
x.d(4): Error: unrecognized pragma(mangle)
x.d(6): Error: undefined identifier 'func'
x.d(7): Error: undefined identifier 'func'
Seemingly, the only user-side fix is moving the declaration out of the function
body.
--
    
    
More information about the Digitalmars-d-bugs
mailing list