This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix ICE on __complex__ with initializer list (PR c++/39056)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Jason Merrill <jason at redhat dot com>, Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Tue, 3 Feb 2009 14:59:26 +0100
- Subject: [PATCH] Fix ICE on __complex__ with initializer list (PR c++/39056)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
Without this process_init_constructor is called with COMPLEX_TYPE, which
is not handled there.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
2009-02-02 Jakub Jelinek <jakub@redhat.com>
PR c++/39056
* typeck2.c (digest_init_r): Don't call process_init_constructor
for COMPLEX_TYPE.
* g++.dg/cpp0x/initlist13.C: New test.
--- gcc/cp/typeck2.c.jj 2009-01-13 18:32:14.000000000 +0100
+++ gcc/cp/typeck2.c 2009-02-02 12:15:58.000000000 +0100
@@ -789,7 +789,8 @@ digest_init_r (tree type, tree init, boo
}
/* 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;
--- gcc/testsuite/g++.dg/cpp0x/initlist13.C.jj 2009-02-03 09:28:35.000000000 +0100
+++ gcc/testsuite/g++.dg/cpp0x/initlist13.C 2009-02-03 09:28:26.000000000 +0100
@@ -0,0 +1,5 @@
+// PR c++/39056
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+__complex__ int i ({0}); // { dg-error "cannot convert" }
Jakub