www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18955] New: extern(C++) default struct mangling is overridden


          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 puremagic.com
          Reporter: turkeyman gmail.com

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.

Jun 07 2018