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

2018-07-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18955

--- Comment #3 from Manu  ---
I'm sorry. I think I must have cut 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@DV?$char_traits@D@std@@@std@@@Z
But it should emit:
  ?test@@YAXAEBV?$basic_string@DU?$char_traits@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.

--


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

2018-07-12 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18955

Mike Franklin  changed:

   What|Removed |Added

 CC||slavo5...@yahoo.com

--- Comment #2 from Mike Franklin  ---
`alias string = basic_string!(char, char_traits!char);` has two template
arguments, but `extern (C++, class) struct basic_string(T, Traits, Alloc)` had
3.

This results in:
Error: template instance `basic_string!(char, char_traits!char)` does not match
template declaration

I'm not sure what I should be doing to reproduce the problem.

--


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

2018-06-07 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=18955

Manu  changed:

   What|Removed |Added

   Keywords||C++, industry

--- Comment #1 from Manu  ---
This symptom is a result of the same logic that causes the related ICE at
typesem.d:~1310
I don't understand the logic, perhaps Walter can take a look who understands
the intent of that code?

--