diff --git a/src/mtype.c b/src/mtype.c index 5ebb1b585911..13da088610af 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -8615,6 +8615,16 @@ Expression *TypeClass::dotExp(Scope *sc, Expression *e, Identifier *ident) return e; } + #if 1 // Workaround for Bugzilla 9213 + FuncDeclaration *fd = sc->func; + if (d->needThis() && d->isVarDeclaration() && fd && fd->vthis) + { + e = new DotVarExp(e->loc, new ThisExp(e->loc), d); + e = e->semantic(sc); + return e; + } + #endif + FuncDeclaration *fdthis = hasThis(sc); if (d->needThis() && fdthis) { diff --git a/test/runnable/traits.d b/test/runnable/traits.d index f8d5b987e46c..86dcbfa87c3d 100644 --- a/test/runnable/traits.d +++ b/test/runnable/traits.d @@ -660,12 +660,17 @@ alias T6073!(__traits(parent, S6073)) U6073; // error static assert(__traits(isSame, V6073, U6073)); // same instantiation == same arguemnts /********************************************************/ +// 7027 -struct Foo7027 { - int a; -} +struct Foo7027 { int a; } static assert(!__traits(compiles, { return Foo7027.a; })); +/********************************************************/ +// 9213 + +class Foo9213 { int a; } +static assert(!__traits(compiles, { return Foo9213.a; })); + /********************************************************/ interface AA