Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Merge pull request #2679 from 9rnsr/fix11245

[REG2.063] Issue 11245 - Can't access length of static arrays from within classes
  • Loading branch information...
commit a913ce4bc59a94a022a27e390fc841f4aededffb 1 parent 94dd059
Walter Bright authored October 18, 2013
11  src/mtype.c
@@ -6559,8 +6559,7 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc,
6559 6559
             RootObject *id = idents[i];
6560 6560
             Type *t = s->getType();     // type symbol, type alias, or type tuple?
6561 6561
             Dsymbol *sm = s->searchX(loc, sc, id);
6562  
-            //printf("\t3: s = '%s' %p, kind = '%s'\n",s->toChars(), s, s->kind());
6563  
-            //printf("\tgetType = '%s'\n", s->getType()->toChars());
  6562
+            //printf("\t3: s = %p %s %s, sm = %p\n", s, s->kind(), s->toChars(), sm);
6564 6563
             if (intypeid && !t && sm && sm->needThis())
6565 6564
                 goto L3;
6566 6565
             if (!sm)
@@ -6589,7 +6588,13 @@ void TypeQualified::resolveHelper(Loc loc, Scope *sc,
6589 6588
                             goto L2;
6590 6589
                     }
6591 6590
                 L3:
6592  
-                    Expression *e = new DsymbolExp(loc, s);
  6591
+                    Expression *e;
  6592
+                    VarDeclaration *v = s->isVarDeclaration();
  6593
+                    FuncDeclaration *f = s->isFuncDeclaration();
  6594
+                    if (intypeid || !v && !f)
  6595
+                        e = new DsymbolExp(loc, s);
  6596
+                    else
  6597
+                        e = new VarExp(loc, s->isDeclaration());
6593 6598
                     e = e->semantic(sc);
6594 6599
                     for (; i < idents.dim; i++)
6595 6600
                     {
17  test/runnable/testrightthis.d
@@ -513,6 +513,23 @@ void test9633()
513 513
 }
514 514
 
515 515
 /********************************************************/
  516
+// 11245
  517
+
  518
+struct Vec11245
  519
+{
  520
+    float[2] f;
  521
+}
  522
+
  523
+class Bar11245
  524
+{
  525
+    void func()
  526
+    {
  527
+        pragma(msg, "====");
  528
+        float[Vec11245.f.length] newVal;
  529
+    }
  530
+}
  531
+
  532
+/********************************************************/
516 533
 
517 534
 int main()
518 535
 {

0 notes on commit a913ce4

Please sign in to comment.
Something went wrong with that request. Please try again.