aboutsummaryrefslogtreecommitdiff
path: root/gcc/d/dmd/semantic2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d/dmd/semantic2.c')
-rw-r--r--gcc/d/dmd/semantic2.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/d/dmd/semantic2.c b/gcc/d/dmd/semantic2.c
index 7bcf6ce4f33..194a3fb9661 100644
--- a/gcc/d/dmd/semantic2.c
+++ b/gcc/d/dmd/semantic2.c
@@ -163,6 +163,15 @@ public:
if (vd->_init && !vd->toParent()->isFuncDeclaration())
{
vd->inuse++;
+
+ /* https://issues.dlang.org/show_bug.cgi?id=20280
+ *
+ * Template instances may import modules that have not
+ * finished semantic1.
+ */
+ if (!vd->type)
+ dsymbolSemantic(vd, sc);
+
// Bugzilla 14166: Don't run CTFE for the temporary variables inside typeof
vd->_init = initializerSemantic(vd->_init, sc, vd->type, sc->intypeof == 1 ? INITnointerpret : INITinterpret);
vd->inuse--;
@@ -265,6 +274,17 @@ public:
{
if (fd->semanticRun >= PASSsemantic2done)
return;
+
+ if (fd->semanticRun < PASSsemanticdone && !fd->errors)
+ {
+ /* https://issues.dlang.org/show_bug.cgi?id=21614
+ *
+ * Template instances may import modules that have not
+ * finished semantic1.
+ */
+ dsymbolSemantic(fd, sc);
+ }
+
assert(fd->semanticRun <= PASSsemantic2);
fd->semanticRun = PASSsemantic2;