DR 2413 - typename in conversion-function-ids.

* parser.c (cp_parser_conversion_type_id): Call
	cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
	instead of CP_PARSER_FLAGS_NONE.

	* g++.dg/cpp2a/typename17.C: New test.

From-SVN: r274136
This commit is contained in:
Marek Polacek 2019-08-06 02:23:43 +00:00 committed by Marek Polacek
parent 5e74e93c1c
commit c026e33449
4 changed files with 21 additions and 2 deletions

View File

@ -1,3 +1,10 @@
2019-08-05 Marek Polacek <polacek@redhat.com>
DR 2413 - typename in conversion-function-ids.
* parser.c (cp_parser_conversion_type_id): Call
cp_parser_type_specifier_seq with CP_PARSER_FLAGS_TYPENAME_OPTIONAL
instead of CP_PARSER_FLAGS_NONE.
2019-08-05 Paolo Carlini <paolo.carlini@oracle.com>
* cp-tree.h (cp_expr_loc_or_input_loc): New.

View File

@ -14844,8 +14844,9 @@ cp_parser_conversion_type_id (cp_parser* parser)
parser->type_definition_forbidden_message
= G_("types may not be defined in a conversion-type-id");
/* Parse the type-specifiers. */
cp_parser_type_specifier_seq (parser, CP_PARSER_FLAGS_NONE,
/* Parse the type-specifiers. DR 2413 clarifies that `typename' is
optional in conversion-type-id. */
cp_parser_type_specifier_seq (parser, CP_PARSER_FLAGS_TYPENAME_OPTIONAL,
/*is_declaration=*/false,
/*is_trailing_return=*/false,
&type_specifiers);

View File

@ -1,3 +1,8 @@
2019-08-05 Marek Polacek <polacek@redhat.com>
DR 2413 - typename in conversion-function-ids.
* g++.dg/cpp2a/typename17.C: New test.
2019-08-05 Martin Sebor <msebor@redhat.com>
PR middle-end/50476

View File

@ -0,0 +1,6 @@
// DR 2413 - typename in conversion-function-ids.
// { dg-do compile { target c++2a } }
template<class T> struct S {
operator T::X();
};