@@ -16784,6 +16784,14 @@ cp_parser_init_declarator (cp_parser* parser,
warning (OPT_Wattributes,
"attributes after parenthesized initializer ignored");
+ /* Declarations involving function parameter lists containing implicit
+ template parameters will have been made into implicit templates. If they
+ do not turn out to be actual function declarations then finish the
+ template declaration here. */
+ if (parser->fully_implicit_function_template_p)
+ if (!function_declarator_p (declarator))
+ finish_fully_implicit_template (parser, /*member_decl_opt=*/0);
+
/* For an in-class declaration, use `grokfield' to create the
declaration. */
if (member_p)
new file mode 100644
@@ -0,0 +1,16 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++1y" }
+
+// PR c++/59638
+
+
+void (*a)(auto); // { dg-error "template declaration" }
+
+void (*b)(auto) = 0; // { dg-error "template declaration" }
+
+typedef void (*f)(auto); // { dg-error "template declaration" }
+
+struct A
+{
+ int i;
+};