diff --git a/compiler/src/dmd/semantic2.d b/compiler/src/dmd/semantic2.d index 4bb39028f0..92ca7301ad 100644 --- a/compiler/src/dmd/semantic2.d +++ b/compiler/src/dmd/semantic2.d @@ -888,4 +888,11 @@ private extern(C++) final class StaticAAVisitor : SemanticTimeTransitiveVisitor aaExp.lowering = loweredExp; } + + // https://issues.dlang.org/show_bug.cgi?id=24602 + // TODO: Is this intionally not visited by SemanticTimeTransitiveVisitor? + override void visit(ClassReferenceExp crExp) + { + this.visit(crExp.value); + } } diff --git a/compiler/test/runnable/staticaa.d b/compiler/test/runnable/staticaa.d index 089144c4fb..6b8fb45807 100644 --- a/compiler/test/runnable/staticaa.d +++ b/compiler/test/runnable/staticaa.d @@ -181,6 +181,32 @@ void testStaticArray() ///////////////////////////////////////////// +// https://issues.dlang.org/show_bug.cgi?id=24602 + +class Set +{ + bool[string] aa; + + this(bool[string] aa) + { + this.aa = aa; + } +} + +class Bar +{ + Set x = new Set(["a": 1, "b": 0]); +} + +void testClassLiteral() +{ + assert(new Bar().x.aa["a"] == 1); + assert(new Bar().x.aa["b"] == 0); +} + +///////////////////////////////////////////// + + void main() { testSimple(); @@ -192,4 +218,5 @@ void main() testLocalStatic(); testEnumInit(); testStaticArray(); + testClassLiteral(); }