D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15576 - extern(C++, namespace) wrong mangling of variables (Windows)
Summary: extern(C++, namespace) wrong mangling of variables (Windows)
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords: bootcamp, C++
Depends on:
Blocks:
 
Reported: 2016-01-18 05:36 UTC by Manu
Modified: 2017-01-16 23:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Manu 2016-01-18 05:36:42 UTC
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.
Comment 1 Johan Engelen 2016-11-02 13:40:01 UTC
I ran into the same problem.

Simpler reproducer:

D:
extern (C++, ep) extern __gshared int variable;

C++:
namespace ep {
  int variable;
}
Comment 2 Johan Engelen 2016-11-02 14:00:20 UTC
Bootcamp hint: start looking at `mangleVariable` in `VisualCPPMangler` in cppmangle.d.
Comment 3 Walter Bright 2016-11-03 03:22:43 UTC
https://github.com/dlang/dmd/pull/6232
Comment 4 github-bugzilla 2016-11-06 09:15:23 UTC
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.
Comment 5 github-bugzilla 2016-12-27 14:40:52 UTC
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
Comment 6 github-bugzilla 2017-01-16 23:24:24 UTC
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