On Thursday, 8 March 2018 at 17:04:02 UTC, Steven Schveighoffer
wrote:
On 3/8/18 11:35 AM, Markus wrote:
When I do this locally on my mac, I get a similar error. When I
nm the main.o file vs. the lib.o file, I see different mangled
names.
It appears that the D mangled name is not doing back
references. This is probably why the change to another
namespace for the function works (there isn't a back reference)
In order to demonstrate this better, I did namespace
thenamespace instead of ns_a.
The symbol I see in the D file:
U __ZN12thenamespace13some_functionEPN12thenamespace7class_aE
And in the C++ file:
T __ZN12thenamespace13some_functionEPNS_7class_aE
Note the difference is instead of 12thenamespace, it's S_,
which probably is a back reference. Googled...
Yep, I'm right:
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#mangle.seq-id
I'd recommend filing a bug.
-Steve
You are right.
$ dmd -c main.d
$ nm main.o | grep some
U _ZN4ns_a13some_functionEPN4ns_a7class_aE
$ nm lib.o | grep some
0000000000000000 T _ZN4ns_a13some_functionEPNS_7class_aE
But when i merge the main.d and other.d I get
$ nm main.o | grep some
U _ZN4ns_a13some_functionEPNS_7class_aE
I tested dmd (2.079.0), gdc and ldc2. All got the same result.
Which makes me think, that it's not a bug, but a "feature" :)