@@ -18026,7 +18026,9 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
(void) cleanup;
if (!processing_specialization)
- parser->auto_is_implicit_function_template_parm_p = true;
+ if (!current_function_decl
+ || (current_class_type && LAMBDA_TYPE_P (current_class_type)))
+ parser->auto_is_implicit_function_template_parm_p = true;
/* Peek at the next token. */
token = cp_lexer_peek_token (parser->lexer);
@@ -3,5 +3,5 @@
void foo()
{
- void (*fp)(auto); // { dg-error "template" }
+ void (*fp)(auto); // { dg-error "auto|not permitted" }
}
new file mode 100644
@@ -0,0 +1,12 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+
+// PR c++/59112
+
+void foo()
+{
+ struct A
+ {
+ A(auto) {} // { dg-error "auto|not permitted" }
+ };
+}
new file mode 100644
@@ -0,0 +1,11 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+
+// PR c++/59113
+
+void foo()
+{
+ void bar(auto) {} // { dg-error "function-definition|auto|not permitted" }
+}
+
+auto i = 0;