This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/39056] [4.4 regression] [c++0x] ICE with invalid initializer list for complex variable
- From: "jakub at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Feb 2009 11:18:24 -0000
- Subject: [Bug c++/39056] [4.4 regression] [c++0x] ICE with invalid initializer list for complex variable
- References: <bug-39056-1771@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from jakub at gcc dot gnu dot org 2009-02-02 11:18 -------
I think this depends on whether we want as an exception allow this or not.
If not, e.g.:
--- typeck2.c.jj22009-01-13 18:32:14.000000000 +0100
+++ typeck2.c2009-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;
gets rid of the ICE, instead it will reject it with:
pr39056.C:1: error: cannot convert '<brace-enclosed initializer list>' to 'int
__complex__' in initialization
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39056