===================================================================
@@ -0,0 +1,7 @@
+// PR c++/42056
+// { dg-options -std=c++0x }
+
+template<int> struct A
+{
+ int a[auto(1)]; // { dg-error "invalid use of" }
+};
===================================================================
@@ -0,0 +1,7 @@
+// PR c++/42056
+// { dg-options -std=c++0x }
+
+template<int> void foo()
+{
+ int a[auto(1)]; // { dg-error "invalid use of" }
+}
===================================================================
@@ -1599,6 +1599,13 @@ build_functional_cast (tree exp, tree parms, tsubs
return error_mark_node;
}
+ if (type_uses_auto (type))
+ {
+ if (complain & tf_error)
+ error ("invalid use of %<auto%>");
+ type = error_mark_node;
+ }
+
if (processing_template_decl)
{
tree t;