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 };