www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20974] New: extern(C++, "foo", "bar") template mangling

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

          Issue ID: 20974
           Summary: extern(C++, "foo", "bar") template mangling ignores
                    "foo".
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: rmanth gmail.com

alias B = A!();

extern(C++, "foo", "bar")
struct A()
{
    double f();
}

pragma(msg, A!().f.mangleof);


On linux it should print _ZN3foo3bar1A1fEv but prints _ZN3bar1A1fEv
On windows it should print ?f ?$A  bar foo  QEAANXZ but prints
?f ?$A  bar  QEAANXZ

This basically ignores the "foo" part of the namespace. If you change or remove
the "foo" you get the same result.

If you remove the `alias B = A!()` or move that after the declaration of `A` it
gets the correct mangle.

If you change it to `extern(C++, foo.bar)` it gets the correct mangle.

--
Jun 24 2020