PR c++/42387
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Dec 2009 17:36:05 +0000 (17:36 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 16 Dec 2009 17:36:05 +0000 (17:36 +0000)
* decl.c (compute_array_index_type): Mark a VLA as dependent.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155292 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/vla8.C [new file with mode: 0644]

index f00ef84..8d2663b 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-16  Jason Merrill  <jason@redhat.com>
+
+       PR c++/42387
+       * decl.c (compute_array_index_type): Mark a VLA as dependent.
+
 2009-12-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/42358
index 5b37ef7..1c3f2ef 100644 (file)
@@ -7270,11 +7270,8 @@ compute_array_index_type (tree name, tree size)
         structural equality checks.  */
       itype = build_index_type (build_min (MINUS_EXPR, sizetype,
                                           size, integer_one_node));
-      if (!TREE_SIDE_EFFECTS (size))
-       {
-         TYPE_DEPENDENT_P (itype) = 1;
-         TYPE_DEPENDENT_P_VALID (itype) = 1;
-       }
+      TYPE_DEPENDENT_P (itype) = 1;
+      TYPE_DEPENDENT_P_VALID (itype) = 1;
       SET_TYPE_STRUCTURAL_EQUALITY (itype);
       return itype;
     }
index d0c0985..d2beaf3 100644 (file)
@@ -1,3 +1,8 @@
+2009-12-15  Jason Merrill  <jason@redhat.com>
+
+       PR c++/42387
+       * g++.dg/ext/vla8.C: New.
+
 2009-12-16  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.c-torture/compile/20091215-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/ext/vla8.C b/gcc/testsuite/g++.dg/ext/vla8.C
new file mode 100644 (file)
index 0000000..7b7428d
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/42387
+// { dg-options "" }
+
+template<class PF>
+struct AvlTreeIter
+{
+  int Num();
+
+  AvlTreeIter()
+  {
+    new (void* [Num()]);
+  }
+};
+
+AvlTreeIter<int> a;