https://issues.dlang.org/show_bug.cgi?id=22966
Issue ID: 22966
Summary: Inconsistent `shared`attribute for generated
destructor
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
The `shared` attribute for a generated destructor seems NOT to depend on the
aggregate alone:
```
struct WithDtor {
int x;
~this() {}
}
struct A {
WithDtor withDtor;
}
struct B {
version (Shared)
shared A a;
else
A a;
}
struct C {
A a;
}
void main() {
B b;
pragma(msg, A.__xdtor.mangleof);
}
```
With DMD v2.099:
```
$ dmd -o- foo.d
_D3mod1A11__fieldDtorMFZv
$ dmd -o- foo.d -version=Shared
_D3mod1A11__fieldDtorMOFZv
```
This leads to linker errors in real-world code.
--