[Issue 19101] Miscompilation on extern(C++) overloads with D types

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Aug 14 16:31:30 UTC 2018


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

--- Comment #4 from johanengelen at weka.io ---
> Not sure if a dot can be used in typenames for C++ mangling.

Good point. `a.A` should not be mangled as `a::A` (using the C++ namespace
divider), because that then would clash with C++ types.

I think it is OK if the mangle can never be expressed in C++ when there are D
types involved, because C++ cannot express the D types anyway. What I mean is,
`foo!A` should be expressible in C++:
```
extern(C++) struct A {}
extern(C++) int foo(T)(T t) {}
```
but doesn't have to in this code:
```
struct A {}
extern(C++) int foo(T)(T t) {}
```

So C++ doesn't have to be able to express the mangled name, but it would
definitely be nice if C++ demanglers can demangle it into something sensible. A
dot is actually allowed in symbol names, so we can use it as part of the name?
(i.e. pretend that the class name of A is "a.A".)

--


More information about the Digitalmars-d-bugs mailing list