]> 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>
Tue, 5 Nov 2013 18:03:03 +0000 (13:03 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 5 Nov 2013 18:03:03 +0000 (13:03 -0500)
PR c++/58868
* decl.c (check_initializer): Don't use build_vec_init for arrays
of trivial type.

From-SVN: r204406

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/init/array35.C [new file with mode: 0644]

index fb9e0c6826906442a6f76155927c9452a8182120..887ea61594416c5800790174091f0253bc159fb3 100644 (file)
@@ -1,3 +1,9 @@
+2013-11-05  Jason Merrill  <jason@redhat.com>
+
+       PR c++/58868
+       * decl.c (check_initializer): Don't use build_vec_init for arrays
+       of trivial type.
+
 2013-11-05  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/58724
index e662764da8598a671aa89527a3a074531128d124..8b7a89fcd991afd91c1f595dc69b0d5d1a78ed7a 100644 (file)
@@ -5683,6 +5683,7 @@ check_initializer (tree decl, tree init, int flags, vec<tree, va_gc> **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 (file)
index 0000000..6ce6d5c
--- /dev/null
@@ -0,0 +1,3 @@
+// PR c++/58868
+
+static struct { const int i; } a[] = { 1 };