From d235e4cc28ab227c43f91ee88af794947ad5dca3 Mon Sep 17 00:00:00 2001 From: Alexey Prokhin Date: Sat, 7 Dec 2013 18:05:02 +0400 Subject: [PATCH] Fix DMD Issue 10425 - Link error with templates. Merged dmdfe changes in typeinf.c --- gen/typinf.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/gen/typinf.cpp b/gen/typinf.cpp index cbe7e00d..361685a6 100644 --- a/gen/typinf.cpp +++ b/gen/typinf.cpp @@ -109,6 +109,11 @@ Expression *Type::getInternalTypeInfo(Scope *sc) return t->getTypeInfo(sc); } + +bool inNonRoot(Dsymbol *s); +FuncDeclaration *search_toHash(StructDeclaration *sd); +FuncDeclaration *search_toString(StructDeclaration *sd); + /**************************************************** * Get the exact TypeInfo. */ @@ -146,9 +151,23 @@ Expression *Type::getTypeInfo(Scope *sc) if (!t->builtinTypeInfo()) { // Generate COMDAT if (sc) // if in semantic() pass - { // Find module that will go all the way to an object file + { + // Find module that will go all the way to an object file Module *m = sc->module->importedFrom; m->members->push(t->vtinfo); + + if (ty == Tstruct) + { + StructDeclaration *sd = ((TypeStruct *)this)->sym; + if ((sd->xeq && sd->xeq != sd->xerreq || + sd->xcmp && sd->xcmp != sd->xerrcmp || + search_toHash(sd) || + search_toString(sd) + ) && inNonRoot(sd)) + { + Module::addDeferredSemantic3(sd); + } + } } else // if in obj generation pass {