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;

Reply via email to