Skip to content

Commit d904351

Browse files
committed
Fix issue ldc-developers#3501: Don't re-define struct TypeInfos
Surfacing now as ldc-developers#3486 added a corresponding assertion. I've tested this with an older vibe-d v0.8.6 lying around on my box. The assertion was hit for the TypeInfo of a nested struct: https://github.com/vibe-d/vibe.d/blob/3c7ae13989003b7ebc59de23c5b6a0fb0466f119/http/vibe/http/router.d#L570-L574 I wasn't able to quickly reduce it to a stand-alone testcase and am reluctant to put any more effort into this.
1 parent 0d09a17 commit d904351

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

gen/typinf.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,12 @@ class DeclareOrDefineVisitor : public Visitor {
507507
return;
508508
}
509509

510-
defineGlobal(gvar, irstruct->getTypeInfoInit(), irstruct->aggrdecl);
511-
gvar->setLinkage(TYPEINFO_LINKAGE_TYPE); // override
510+
LLConstant *init = irstruct->getTypeInfoInit(); // might define gvar!
511+
512+
if (!gvar->hasInitializer()) {
513+
defineGlobal(gvar, init, irstruct->aggrdecl);
514+
gvar->setLinkage(TYPEINFO_LINKAGE_TYPE); // override
515+
}
512516
}
513517

514518
// Only declare class TypeInfos. They are defined once in their owning module

0 commit comments

Comments
 (0)