www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22021] New: pragma(mangle) not accepted in function body

https://issues.dlang.org/show_bug.cgi?id=22021

          Issue ID: 22021
           Summary: pragma(mangle) not accepted in function body
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: maxsamukha gmail.com

void main() {
    pragma(mangle, "bar")
    extern(C) static void foo() {
    }
}

onlineapp.d(4): Error: unrecognized `pragma(mangle)`

To workaround, use a dummy struct:

void main() {
    static struct S {
       pragma(mangle, "bar")
       extern(C) static void foo() {
       }
    }
}

--
Jun 13