PR c++/84798 - ICE with auto in abstract function declarator.

* parser.c (cp_parser_parameter_declaration_clause): Check
	parser->default_arg_ok_p.

From-SVN: r258493
This commit is contained in:
Jason Merrill 2018-03-13 11:55:07 -04:00 committed by Jason Merrill
parent f99309b288
commit 426c1e2ec7
4 changed files with 20 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2018-03-13 Jason Merrill <jason@redhat.com>
PR c++/84798 - ICE with auto in abstract function declarator.
* parser.c (cp_parser_parameter_declaration_clause): Check
parser->default_arg_ok_p.
2018-03-13 Jakub Jelinek <jakub@redhat.com>
PR c++/84808

View File

@ -21198,7 +21198,10 @@ cp_parser_parameter_declaration_clause (cp_parser* parser)
if (!processing_specialization
&& !processing_template_parmlist
&& !processing_explicit_instantiation)
&& !processing_explicit_instantiation
/* default_arg_ok_p tracks whether this is a parameter-clause for an
actual function or a random abstract declarator. */
&& parser->default_arg_ok_p)
if (!current_function_decl
|| (current_class_type && LAMBDA_TYPE_P (current_class_type)))
parser->auto_is_implicit_function_template_parm_p = true;

View File

@ -0,0 +1,9 @@
// PR c++/84798
// { dg-do compile { target c++11 } }
template<typename T>
struct S {
static constexpr T value = 0;
};
constexpr auto x = S<void(*)(auto)>::value; // { dg-error "auto" }

View File

@ -1,8 +1,7 @@
// PR c++/60393
// { dg-do compile { target c++14 } }
// { dg-options "" }
void (*f)(auto) + 0; // { dg-error "expected" }
void (*f)(auto) + 0; // { dg-error "auto|expected" }
struct A
{