[Bug c++/58705] [4.7/4.8/4.9 Regression] [c++11] ICE with invalid initializer for _Complex variable
mpolacek at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 14 09:03:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58705
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
This will fix the ICE, but perhaps we want to give an error instead...
I'll regtest this and post to ML.
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -833,7 +833,8 @@ check_narrowing (tree type, tree init)
&& TREE_CODE (type) == COMPLEX_TYPE)
{
tree elttype = TREE_TYPE (type);
- check_narrowing (elttype, CONSTRUCTOR_ELT (init, 0)->value);
+ if (CONSTRUCTOR_NELTS (init) > 0)
+ check_narrowing (elttype, CONSTRUCTOR_ELT (init, 0)->value);
if (CONSTRUCTOR_NELTS (init) > 1)
check_narrowing (elttype, CONSTRUCTOR_ELT (init, 1)->value);
return;
More information about the Gcc-bugs
mailing list