]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/58868 (ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x)
authorJason Merrill <jason@redhat.com>
Sat, 23 Nov 2013 16:28:57 +0000 (11:28 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Sat, 23 Nov 2013 16:28:57 +0000 (11:28 -0500)
PR c++/58868
* init.c (build_aggr_init): Don't clobber the type of init
if we got an INIT_EXPR back from build_vec_init.
(build_vec_init): Do digest_init on trivial initialization.

From-SVN: r205311

gcc/cp/ChangeLog
gcc/cp/init.c

index 05aa444d43914a457c6fa224dd9ed75dab8f2ab9..91e4132907b9ca64c0c12785f4782446af7f3d45 100644 (file)
@@ -1,3 +1,10 @@
+2013-11-23  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58868
+       * init.c (build_aggr_init): Don't clobber the type of init
+       if we got an INIT_EXPR back from build_vec_init.
+       (build_vec_init): Do digest_init on trivial initialization.
+
 2013-11-23  Alexander Ivchenko  <alexander.ivchenko@intel.com>
 
        PR c++/58525
index dc40989cc10736706574b55fd349c01adbaf7876..1e6e6915bdcb07682f2414f7fc078bdf6ad63e9e 100644 (file)
@@ -1507,7 +1507,8 @@ build_aggr_init (tree exp, tree init, int flags, tsubst_flags_t complain)
       TREE_READONLY (exp) = was_const;
       TREE_THIS_VOLATILE (exp) = was_volatile;
       TREE_TYPE (exp) = type;
-      if (init)
+      /* Restore the type of init unless it was used directly.  */
+      if (init && TREE_CODE (stmt_expr) != INIT_EXPR)
        TREE_TYPE (init) = itype;
       return stmt_expr;
     }
@@ -3421,6 +3422,8 @@ build_vec_init (tree base, tree maxindex, tree init,
         brace-enclosed initializers.  In this case, digest_init and
         store_constructor will handle the semantics for us.  */
 
+      if (BRACE_ENCLOSED_INITIALIZER_P (init))
+       init = digest_init (atype, init, complain);
       stmt_expr = build2 (INIT_EXPR, atype, base, init);
       if (length_check)
        stmt_expr = build3 (COND_EXPR, atype, length_check,