Bug 22149 – TypeInfo_Struct names aren't unique, leading to botched equality semantics
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-07-27T11:19:20Z
Last change time
2021-08-01T12:04:32Z
Keywords
pull
Assigned to
No Owner
Creator
kinke
Comments
Comment #0 by kinke — 2021-07-27T11:19:20Z
```
struct Foo(T) {}
void main()
{
auto foo()
{
struct S {}
return Foo!S();
}
auto bar()
{
struct S {}
return Foo!S();
}
auto f = foo();
auto b = bar();
// both fail:
assert(typeid(f) != typeid(b));
assert(typeid(f).name != typeid(b).name);
}
```
[TypeInfo_Class names aren't unique either, will file an extra issue about that.]
Comment #1 by dlang-bot — 2021-07-27T11:33:33Z
@kinke updated dlang/dmd pull request #12928 "TypeInfo_Struct: Switch to stored mangled name" fixing this issue:
- Fix Issue 22149 - TypeInfo_Struct names aren't unique, leading to botched equality semantics
By storing the mangled name, making the TypeInfo_Struct names truly
unique and more compact at the same time.
Requires https://github.com/dlang/druntime/pull/3527.https://github.com/dlang/dmd/pull/12928
Comment #2 by dlang-bot — 2021-08-01T12:04:32Z
dlang/dmd pull request #12928 "Fix Issues 22149 & 22150 - TypeInfo names aren't unique, leading to botched equality semantics" was merged into master:
- 65fc66a4583069bfe767d1c28850cdab364ae282 by Martin Kinkelin:
Fix Issue 22149 - TypeInfo_Struct names aren't unique, leading to botched equality semantics
By storing the mangled name, making the TypeInfo_Struct names truly
unique and more compact at the same time.
Requires https://github.com/dlang/druntime/pull/3527.https://github.com/dlang/dmd/pull/12928