re PR c++/60628 ([c++11] ICE initializing array of auto)
authorJason Merrill <jason@redhat.com>
Mon, 14 Jul 2014 05:25:19 +0000 (01:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Jul 2014 05:25:19 +0000 (01:25 -0400)
PR c++/60628
* decl.c (create_array_type_for_decl): Only check for auto once.

From-SVN: r212504

gcc/cp/ChangeLog
gcc/cp/decl.c

index bdad6d90ddfcaa2715d8b3543f81f25311b80e5b..45116eb70b3a4159793ad755b4b3bf2a7c676a7c 100644 (file)
@@ -1,5 +1,8 @@
 2014-07-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/60628
+       * decl.c (create_array_type_for_decl): Only check for auto once.
+
        PR c++/58636
        * call.c (build_list_conv): Don't try to build a list of references.
 
index dae85c2d584e2c63e5f9bd08107219194b70482d..8f829d09e98544240a11ffbded246718295bf4fd 100644 (file)
@@ -8540,9 +8540,11 @@ create_array_type_for_decl (tree name, tree type, tree size)
 
   /* 8.3.4/1: If the type of the identifier of D contains the auto
      type-specifier, the program is ill-formed.  */
-  if (pedantic && type_uses_auto (type))
-    pedwarn (input_location, OPT_Wpedantic,
-            "declaration of %qD as array of %<auto%>", name);
+  if (type_uses_auto (type))
+    {
+      error ("%qD declared as array of %qT", name, type);
+      return error_mark_node;
+    }
 
   /* If there are some types which cannot be array elements,
      issue an error-message and return.  */
@@ -8601,14 +8603,6 @@ create_array_type_for_decl (tree name, tree type, tree size)
       && (flag_iso || warn_vla > 0))
     pedwarn (input_location, OPT_Wvla, "array of array of runtime bound");
 
-  /* 8.3.4p1: ...if the type of the identifier of D contains the auto
-     type-specifier, the program is ill-formed.  */
-  if (type_uses_auto (type))
-    {
-      error ("%qD declared as array of %qT", name, type);
-      return error_mark_node;
-    }
-
   /* Figure out the index type for the array.  */
   if (size)
     itype = compute_array_index_type (name, size, tf_warning_or_error);