From c433604243ca5cf8a28afe13e7a3c7bc316096c3 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 22 May 2009 10:17:47 +0200 Subject: [PATCH] Fix bug #307 by doing what DMD does: add the arrayop to sc->module->importedFrom instead of sc->module. That way array ops in template instantiations will be semantic3'ed. --- dmd/arrayop.c | 4 ++-- gen/llvmhelpers.cpp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dmd/arrayop.c b/dmd/arrayop.c index 7212e5eb..4214d817 100644 --- a/dmd/arrayop.c +++ b/dmd/arrayop.c @@ -281,10 +281,10 @@ Expression *BinExp::arrayOp(Scope *sc) // special attention for array ops fd->isArrayOp = true; - sc->module->members->push(fd); + sc->module->importedFrom->members->push(fd); sc = sc->push(); - sc->parent = sc->module; + sc->parent = sc->module->importedFrom; sc->stc = 0; sc->linkage = LINKd; fd->semantic(sc); diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index 749a0a55..6b823fc5 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -1369,13 +1369,13 @@ bool mustDefineSymbol(Dsymbol* s) { if (FuncDeclaration* fd = s->isFuncDeclaration()) { - if (fd->isArrayOp) - return true; - // we can't (and probably shouldn't?) define functions // that weren't semantic3'ed if (fd->semanticRun < 4) return false; + + if (fd->isArrayOp) + return true; } TemplateInstance* tinst = DtoIsTemplateInstance(s);