[Issue 18955] New: extern(C++) default struct mangling is overridden when interacting with a `cppmangle = class` tamplate

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jun 8 04:29:44 UTC 2018


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

          Issue ID: 18955
           Summary: extern(C++) default struct mangling is overridden when
                    interacting with a `cppmangle = class` tamplate
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

test.c:
------------------------------------------------
extern (C++, std)
{
        extern (C++) struct char_traits(Char)
        {
        }
        extern (C++, class) struct basic_string(T, Traits, Alloc)
        {
        }
        alias string = basic_string!(char, char_traits!char);
}
extern (C++) void test(ref const(std.string) str) {}
------------------------------------------------

char_traits has no mangle spec, so it should mangle as struct, and it does...
except in this case where it's used an a template argument to basic_string
which is mangled as a class, char_traits gets promoted to mangle as a class
too, not only in the instantiation of basic_string but even when it appears on
its own too.

char_traits should mangle as a struct, because that's how it's declared.

--


More information about the Digitalmars-d-bugs mailing list