Skip to content

Commit

Permalink
Merge pull request #2679 from 9rnsr/fix11245
Browse files Browse the repository at this point in the history
[REG2.063] Issue 11245 - Can't access length of static arrays from within classes
  • Loading branch information
WalterBright committed Oct 18, 2013
1 parent 94dd059 commit a913ce4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/mtype.c
Expand Up @@ -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)
Expand Down Expand Up @@ -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++)
{
Expand Down
17 changes: 17 additions & 0 deletions test/runnable/testrightthis.d
Expand Up @@ -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()
Expand Down

0 comments on commit a913ce4

Please sign in to comment.