Bug 19161 – Wrong mangle for C++ classes

Status
RESOLVED
Resolution
DUPLICATE
Severity
enhancement
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-08-12T08:56:15Z
Last change time
2020-02-19T05:33:48Z
Keywords
C++, mangling
Assigned to
No Owner
Creator
Илья Ярошенко

Comments

Comment #0 by ilyayaroshenko — 2018-08-12T08:56:15Z
extern(C++) { class Foo { } void foo(Foo); pragma(msg, foo.mangleof); } mangled to: void __cdecl foo(class Foo * __ptr64) expected (because of common C++ & STL practice): void __cdecl foo(class Foo & __ptr64)
Comment #1 by iamthewilsonator — 2018-08-21T05:51:52Z
Does extern(C++,class) struct Foo { } extern(C++) void foo(ref Foo); pragma(msg, foo.mangleof); work?
Comment #2 by ilyayaroshenko — 2019-04-12T15:14:08Z
Yes, but this workaround breaks a lot of API logic on the D side.
Comment #3 by kinke — 2019-04-12T20:20:01Z
There's no clear right or wrong here, and the proposed change would probably break a lot of code. E.g., all DMD C++ headers would need to be adapted. Additionally, a D class reference can safely be assumed to be null, while you normally don't expect null for a C++ reference. => WONTFIX IMO
Comment #4 by pro.mathias.lang — 2020-02-19T05:33:48Z
Duplicate of 18896 which has a bit more specific title. *** This issue has been marked as a duplicate of issue 18896 ***