diff --git a/src/mtype.c b/src/mtype.c index c459b45f9baa..f011278bd5de 100644 --- a/src/mtype.c +++ b/src/mtype.c @@ -6559,8 +6559,7 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc, RootObject *id = idents[i]; Type *t = s->getType(); // type symbol, type alias, or type tuple? Dsymbol *sm = s->searchX(loc, sc, id); - //printf("\t3: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind()); - //printf("\tgetType = '%s'\n", s->getType()->toChars()); + //printf("\t3: s = %p %s %s, sm = %p\n", s, s->kind(), s->toChars(), sm); if (intypeid && !t && sm && sm->needThis()) goto L3; if (!sm) @@ -6589,7 +6588,13 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc, goto L2; } L3: - Expression *e = new DsymbolExp(loc, s); + Expression *e; + VarDeclaration *v = s->isVarDeclaration(); + FuncDeclaration *f = s->isFuncDeclaration(); + if (intypeid || !v && !f) + e = new DsymbolExp(loc, s); + else + e = new VarExp(loc, s->isDeclaration()); e = e->semantic(sc); for (; i < idents.dim; i++) { diff --git a/test/runnable/testrightthis.d b/test/runnable/testrightthis.d index 147751c0ab0c..2cfadf3c2eb2 100644 --- a/test/runnable/testrightthis.d +++ b/test/runnable/testrightthis.d @@ -512,6 +512,23 @@ void test9633() foo.vaz(); } +/********************************************************/ +// 11245 + +struct Vec11245 +{ + float[2] f; +} + +class Bar11245 +{ + void func() + { + pragma(msg, "===="); + float[Vec11245.f.length] newVal; + } +} + /********************************************************/ int main()