``` 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.]
@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
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