On 03/25/2014 01:43 PM, Jason Merrill wrote:
We got confused tsubsting the VLA type because tsubst doesn't expect to
see a SAVE_EXPR.  Simple to fix by enforcing the rule against auto arrays.

Oops, we already had a diagnostic for this, we just needed to make it an unconditional error.

Tested x86_64-pc-linux-gnu, applying to trunk.


commit 3915e30387d23d3ec46b6793d619f73f35fe5289
Author: Jason Merrill <ja...@redhat.com>
Date:   Sun Jul 13 11:56:48 2014 -0400

    	PR c++/60628
    	* decl.c (create_array_type_for_decl): Only check for auto once.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index dae85c2..8f829d0 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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);

Reply via email to