re PR c++/27491 (ICE on variable initialization)
authorJakub Jelinek <jakub@redhat.com>
Wed, 17 May 2006 08:42:47 +0000 (10:42 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 17 May 2006 08:42:47 +0000 (10:42 +0200)
PR c++/27491
* semantics.c (finish_compound_literal): Only set TREE_HAS_CONSTRUCTOR
on CONSTRUCTORs.

* g++.dg/init/brace5.C: New test.

From-SVN: r113847

gcc/cp/ChangeLog
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/init/brace5.C [new file with mode: 0644]

index 8a318578fb3d93c6121b3642fdcdd415e1ce1663..b54dfb8474254f6f17ba13788e5c3b76e0b6657c 100644 (file)
@@ -1,5 +1,9 @@
 2006-05-17  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/27491
+       * semantics.c (finish_compound_literal): Only set TREE_HAS_CONSTRUCTOR
+       on CONSTRUCTORs.
+
        PR middle-end/27415
        * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
        on combined parallel workshare constructs.
index 1e315e2d1233de6d43575ab269dc4e9a8bf2018d..f7a3b408f42433890161b4942b1874a97e469acd 100644 (file)
@@ -2033,7 +2033,8 @@ finish_compound_literal (tree type, VEC(constructor_elt,gc) *initializer_list)
     }
 
   /* Mark it as a compound-literal.  */
-  TREE_HAS_CONSTRUCTOR (compound_literal) = 1;
+  if (TREE_CODE (compound_literal) == CONSTRUCTOR)
+    TREE_HAS_CONSTRUCTOR (compound_literal) = 1;
 
   return compound_literal;
 }
index b5339b2ec1b8b92030c332a46113c9b5f7faff09..e610ce5552a7ef939264b07fc7c220f8307d9619 100644 (file)
@@ -1,11 +1,12 @@
 2006-05-17  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/27491
+       * g++.dg/init/brace5.C: New test.
+
        PR middle-end/27415
        * gcc.dg/gomp/pr27415.c: New test.
        * g++.dg/gomp/pr27415.C: New test.
 
-2006-05-17  Jakub Jelinek  <jakub@redhat.com>
-
        PR tree-optimization/27549
        * g++.dg/tree-ssa/pr27549.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/init/brace5.C b/gcc/testsuite/g++.dg/init/brace5.C
new file mode 100644 (file)
index 0000000..696bbd6
--- /dev/null
@@ -0,0 +1,7 @@
+// PR c++/27491
+// { dg-do compile }
+// { dg-options "" }
+
+int i = (int) { 0 };
+int j = (int) { i };
+int k = (int) { k };