]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/39056 ([c++0x] ICE with invalid initializer list for complex variable)
authorJakub Jelinek <jakub@redhat.com>
Tue, 3 Feb 2009 17:23:11 +0000 (18:23 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 3 Feb 2009 17:23:11 +0000 (18:23 +0100)
PR c++/39056
* typeck2.c (digest_init_r): Don't call process_init_constructor
for COMPLEX_TYPE.

* g++.dg/cpp0x/initlist13.C: New test.

From-SVN: r143899

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

index 39a5eb855a22c0043280acbf1158d5403f275dfd..c84de888aed40988a13bbc520cc7781be40f868c 100644 (file)
@@ -1,3 +1,9 @@
+2009-02-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/39056
+       * typeck2.c (digest_init_r): Don't call process_init_constructor
+       for COMPLEX_TYPE.
+
 2009-02-03  Paolo Bonzini  <bonzini@gnu.org>
 
        PR c++/36897
index a19a99920b63131a9d90562945428b1c72950426..526f780cddf1574f21f82098ebfa9d0b2def592f 100644 (file)
@@ -789,7 +789,8 @@ digest_init_r (tree type, tree init, bool nested)
     }
 
   /* Handle scalar types (including conversions) and references.  */
-  if (TREE_CODE (type) != COMPLEX_TYPE
+  if ((TREE_CODE (type) != COMPLEX_TYPE
+       || BRACE_ENCLOSED_INITIALIZER_P (init))
       && (SCALAR_TYPE_P (type) || code == REFERENCE_TYPE))
     {
       tree *exp;
index ba77486a3e7846eb3c106188f59044aa110184d1..128a7620803e69ab91f51479ce398fbb4f96f6f6 100644 (file)
@@ -1,3 +1,8 @@
+2009-02-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/39056
+       * g++.dg/cpp0x/initlist13.C: New test.
+
 2009-02-03  Paolo Bonzini  <bonzini@gnu.org>
 
        PR c++/36897
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist13.C b/gcc/testsuite/g++.dg/cpp0x/initlist13.C
new file mode 100644 (file)
index 0000000..98af92b
--- /dev/null
@@ -0,0 +1,5 @@
+// PR c++/39056
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+__complex__ int i ({0});       // { dg-error "cannot convert" }