[Issue 18955] extern(C++) default struct mangling is overridden when interacting with a `cppmangle = class` tamplate
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 12 18:45:58 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18955
--- Comment #3 from Manu <turkeyman at gmail.com> ---
I'm sorry. I think I must have cut&paste fail-ed. Remove the `Alloc` arg:
-------------------------------
extern (C++, std)
{
struct char_traits(Char)
{
}
extern (C++, class) struct basic_string(T, Traits)
{
}
alias test_string = basic_string!(char, char_traits!char);
}
extern (C++) void test(ref const(std.test_string) str) {}
pragma(msg, test.mangleof);
-------------------------------
Compile that, it will emit:
?test@@YAXAEBV?$basic_string at DV?$char_traits at D@std@@@std@@@Z
But it should emit:
?test@@YAXAEBV?$basic_string at DU?$char_traits at D@std@@@std@@@Z
Notice the 'V?$char_traits' (class) should be a 'U?$char_traits' (struct);
char_traits is a struct.
If you add:
extern (C++, struct) struct char_traits(Char)
ie, tell it explicitly to mangle the struct as a struct, it mangles correctly.
Of course, a struct should mangle as a struct naturally though.
--
More information about the Digitalmars-d-bugs
mailing list