C++: namespace ep { struct Instance {}; Instance *s_pInstance = nullptr; } D: extern (C++, ep) { struct Instance {} extern __gshared Instance* s_pInstance; } C++ mangles: ?s_pInstance@ep@@3PEAUInstance@1@EA D mangles: ?s_pInstance@ep@@2PEAUInstance@1@EA Notice there is a '2' where a '3' should be.
I ran into the same problem. Simpler reproducer: D: extern (C++, ep) extern __gshared int variable; C++: namespace ep { int variable; }
Bootcamp hint: start looking at `mangleVariable` in `VisualCPPMangler` in cppmangle.d.
https://github.com/dlang/dmd/pull/6232
Commits pushed to master at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b725551c35874fdce085a1475f6bd0db398e0f64 Fix issue 15576 - Skip over the parent expression when parent is NSpace. https://github.com/dlang/dmd/commit/dcb58fc97636d9fbe1ee3405be1152c966f456dd Merge pull request #6232 from LemonBoy/cppmangle Fix issue 15576 - Skip over the parent expression when parent is NSpace.
Commits pushed to scope at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b725551c35874fdce085a1475f6bd0db398e0f64 Fix issue 15576 - Skip over the parent expression when parent is NSpace. https://github.com/dlang/dmd/commit/dcb58fc97636d9fbe1ee3405be1152c966f456dd Merge pull request #6232 from LemonBoy/cppmangle
Commits pushed to newCTFE at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/b725551c35874fdce085a1475f6bd0db398e0f64 Fix issue 15576 - Skip over the parent expression when parent is NSpace. https://github.com/dlang/dmd/commit/dcb58fc97636d9fbe1ee3405be1152c966f456dd Merge pull request #6232 from LemonBoy/cppmangle