re PR c++/27270 (ICE in process_init_constructor_array, at cp/typeck2.c:788)
authorMark Mitchell <mark@codesourcery.com>
Tue, 17 Oct 2006 02:01:27 +0000 (02:01 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 17 Oct 2006 02:01:27 +0000 (02:01 +0000)
PR c++/27270
* typeck2.c (process_init_constructor_array): Reword comment.
* pt.c (tsubst_copy_and_built): Call reshape_init before calling
digest_init.
PR c++/27270
* g++.dg/ext/complit8.C: New test.

From-SVN: r117814

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

index ff4718029e30871f37a2894d53294188c6d9f18b..e603fd5e4749bdf91ead735808c90315109c26e5 100644 (file)
@@ -1,5 +1,10 @@
 2006-10-16  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/27270
+       * typeck2.c (process_init_constructor_array): Reword comment.
+       * pt.c (tsubst_copy_and_built): Call reshape_init before calling
+       digest_init.
+
        PR c++/29408
        * parser.c (cp_parser_using_declaration): Stop parsing when
        something goes wrong with an access declaration.
index 744871f35a1466b7668bc962e8208bedc6628caf..ce5a80915f98cc20c7727dfff9595465e700ee0b 100644 (file)
@@ -9351,7 +9351,10 @@ tsubst_copy_and_build (tree t,
        TREE_HAS_CONSTRUCTOR (r) = TREE_HAS_CONSTRUCTOR (t);
 
        if (type)
-         return digest_init (type, r);
+         {
+           r = reshape_init (type, r);
+           return digest_init (type, r);
+         }
        return r;
       }
 
index 6d847cb1cf9d337114897b0233bd5dcf80271b31..725c85fa59718d328b76c3fc536b4383947c3717 100644 (file)
@@ -791,8 +791,8 @@ process_init_constructor_array (tree type, tree init)
     /* Vectors are like simple fixed-size arrays.  */
     len = TYPE_VECTOR_SUBPARTS (type);
 
-  /* There cannot be more initializers than needed (or reshape_init would
-     detect this before we do.  */
+  /* There cannot be more initializers than needed as otherwise
+     reshape_init would have already rejected the initializer.  */
   if (!unbounded)
     gcc_assert (VEC_length (constructor_elt, v) <= len);
 
index 3bf1718e792f13c06232a173cb76cbb45328b8f9..603cbedee8a792cbdf035f6eb502a32e10bb251d 100644 (file)
@@ -1,5 +1,8 @@
 2006-10-16  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/27270
+       * g++.dg/ext/complit8.C: New test.
+
        PR c++/29408
        * g++.dg/parse/dtor12.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/ext/complit8.C b/gcc/testsuite/g++.dg/ext/complit8.C
new file mode 100644 (file)
index 0000000..b778b4b
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/27270
+// { dg-options "" }
+
+template<typename Entry>
+struct Array {
+  Entry *array[32];
+  Array () :
+    array ( (Entry*[1]) { 0, 0 } ) // { dg-error "initializers|conversion" }
+  {}
+};
+
+Array<void*> a;