summaryrefslogtreecommitdiff
blob: 839e0bf2775520aaade900dffeb0af300dcb4f9f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
diff -Nurp a/src/dmd/attrib.c b/src/dmd/attrib.c
--- a/src/dmd/attrib.c	2012-04-17 12:02:10.224883217 +0200
+++ b/src/dmd/attrib.c	2012-04-17 12:31:56.293554287 +0200
@@ -1402,6 +1402,23 @@ void StaticIfDeclaration::setScope(Scope
 
     // But do set the scope, in case we need it for forward referencing
     Dsymbol::setScope(sc);
+
+    // Set the scopes for both the decl and elsedecl, as we don't know yet
+    // which will be selected, and the scope will be the same regardless
+    Dsymbols *d = decl;
+    for (int j = 0; j < 2; j++)
+    {
+        if (d)
+        {
+           for (size_t i = 0; i < d->dim; i++)
+           {
+               Dsymbol *s = (*d)[i];
+
+               s->setScope(sc);
+           }
+        }
+        d = elsedecl;
+    }
 }
 
 void StaticIfDeclaration::semantic(Scope *sc)