[Issue 18922] New: dmd doesn't do substitutions for C++ namespaces in different module/file
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 31 04:15:11 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18922
Issue ID: 18922
Summary: dmd doesn't do substitutions for C++ namespaces in
different module/file
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: pro.mathias.lang at gmail.com
The following test case:
```
extern(C++, testns)
{
struct MyStruct { int i; }
void func (MyStruct x) {}
}
```
Correctly mangles `func` as `__ZN6testns4funcENS_8MyStructE`
However, if `MyStruct` is defined in another module, as the following example
shows:
```
// File cpp.d
module cpp;
import data;
extern(C++, testns)
{
void func (MyStruct x) {}
}
```
```
// File data.d
module data;
extern(C++, testns):
struct MyStruct { int i; }
```
dmd will mangle `func` as `_ZN6testns4funcEN6testns8MyStructE`, not doing the
namespace substitution correctly.
Tested on Mac OSX & Linux x64 with DMD 2.080.
This is a blocker for porting any large C++ code base to D, hence classified as
major.
--
More information about the Digitalmars-d-bugs
mailing list