This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ICE on __complex__ with initializer list (PR c++/39056)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]