Permalink
Browse files

Merge pull request #763 from 9rnsr/fix7578

Issue 7578 - ICE on indexing result of vararg opDispatch
  • Loading branch information...
2 parents 72e6e75 + c286a75 commit f1bb2d86c21298f5a09906d0fb9b09e91178c1af @WalterBright WalterBright committed Mar 18, 2012
Showing with 40 additions and 1 deletion.
  1. +1 −0 src/expression.c
  2. +21 −1 test/runnable/opdisp.d
  3. +18 −0 test/runnable/opover.d
View
@@ -9699,6 +9699,7 @@ Expression *AssignExp::semantic(Scope *sc)
Identifier *id = Id::index;
ae->e1 = ae->e1->semantic(sc);
+ ae->e1 = resolveProperties(sc, ae->e1);
Type *t1 = ae->e1->type->toBasetype();
if (t1->ty == Tstruct)
{
@@ -265,13 +265,33 @@ void test6()
}
/**********************************************/
+// 7578
-void main()
+struct Foo7578
+{
+ static int[] opDispatch(string op, Args...)(Args)
+ {
+ return [0];
+ }
+}
+
+void test7578()
+{
+ Foo7578.attrs[0] = 1;
+}
+
+/**********************************************/
+
+int main()
{
test1();
test2();
test3();
test4();
test5();
test6();
+ test7578();
+
+ printf("Success\n");
+ return 0;
}
@@ -914,6 +914,23 @@ void test15()
//static assert(is(typeof(bug4953(3))));
/**************************************/
+// 4993
+
+// reduced from the bug report
+struct Bar4993
+{
+ void opIndexAssign(int value, size_t index) {}
+}
+@property auto bar4993()
+{
+ return Bar4993();
+}
+void test4993()
+{
+ bar4993[3] = 42;
+}
+
+/**************************************/
int main()
{
@@ -932,6 +949,7 @@ int main()
test13();
test14();
test15();
+ test4993();
printf("Success\n");
return 0;

0 comments on commit f1bb2d8

Please sign in to comment.