From 136d4b89f0f3aca9acce466e00dab8ff0e5fc9b5 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 5 Nov 2013 13:03:03 -0500 Subject: [PATCH] re PR c++/58868 (ICE: in count_type_elements, at expr.c:5495 with -std=gnu++0x) PR c++/58868 * decl.c (check_initializer): Don't use build_vec_init for arrays of trivial type. From-SVN: r204406 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 1 + gcc/testsuite/g++.dg/init/array35.C | 3 +++ 3 files changed, 10 insertions(+) create mode 100644 gcc/testsuite/g++.dg/init/array35.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index fb9e0c68269..887ea615944 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-11-05 Jason Merrill + + PR c++/58868 + * decl.c (check_initializer): Don't use build_vec_init for arrays + of trivial type. + 2013-11-05 Paolo Carlini PR c++/58724 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index e662764da85..8b7a89fcd99 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -5683,6 +5683,7 @@ check_initializer (tree decl, tree init, int flags, vec **cleanups) && !(init && BRACE_ENCLOSED_INITIALIZER_P (init) && CP_AGGREGATE_TYPE_P (type) && (CLASS_TYPE_P (type) + || !TYPE_NEEDS_CONSTRUCTING (type) || type_has_extended_temps (type)))) { init_code = build_aggr_init_full_exprs (decl, init, flags); diff --git a/gcc/testsuite/g++.dg/init/array35.C b/gcc/testsuite/g++.dg/init/array35.C new file mode 100644 index 00000000000..6ce6d5cc956 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/array35.C @@ -0,0 +1,3 @@ +// PR c++/58868 + +static struct { const int i; } a[] = { 1 }; -- 2.30.2