Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions compiler/src/dmd/glue/todt.d
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,25 @@ private extern (C++) class TypeInfoDtVisitor : Visitor
semanticTypeInfoMembers(sd);
}

if (TemplateInstance ti = sd.isInstantiated())
{
if (!ti.needsCodegen())
{
if (sd.xeq && sd.xeq != StructDeclaration.xerreq)
toObjFile(sd.xeq, global.params.multiobj);
if (sd.xcmp && sd.xcmp != StructDeclaration.xerrcmp)
toObjFile(sd.xcmp, global.params.multiobj);
if (FuncDeclaration ftostr = search_toString(sd))
toObjFile(ftostr, global.params.multiobj);
if (sd.xhash)
toObjFile(sd.xhash, global.params.multiobj);
if (sd.postblit)
toObjFile(sd.postblit, global.params.multiobj);
if (sd.dtor)
toObjFile(sd.dtor, global.params.multiobj);
}
}

/* Put out:
* char[] mangledName;
* void[] init;
Expand Down
8 changes: 8 additions & 0 deletions compiler/test/runnable/imports/test23731a.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module imports.test23731a;

struct Wrapper(T)
{
T[] values;
}

enum wrapperIntSize = Wrapper!int.sizeof;
12 changes: 12 additions & 0 deletions compiler/test/runnable/test23731.d
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// https://github.com/dlang/dmd/issues/23731

import imports.test23731a;

void main()
{
auto ti = typeid(Wrapper!int);
auto a = Wrapper!int([1, 2]);
auto b = Wrapper!int([1, 2]);
assert(ti.equals(&a, &b));
assert(ti.getHash(&a) == ti.getHash(&b));
}
Loading