OK.
On Mon, Aug 5, 2019 at 8:03 PM Marek Polacek <pola...@redhat.com> wrote: > > While updating the C++ DR table, I noticed that one of the new DRs, DR 2413, > is trivial: > --- > The “Down with typename!” paper, P0634R3, overlooked the case of a > conversion-type-id > in a conversion-function-id: > > template<class T> struct S { > operator typename T::X(); // typename is not helpful here. > }; > > This context should be added to the list of contexts in which a qualified-id > is assumed > to name a type. > --- > > It's still in "drafting", but it looks like a shoo-in to me. > > Bootstrapped/regtested on x86_64-linux, ok for trunk? > > 2019-08-05 Marek Polacek <pola...@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. > > * g++.dg/cpp2a/typename17.C: New test. > > diff --git gcc/cp/parser.c gcc/cp/parser.c > index 86857e7d468..83e6d24a9c1 100644 > --- gcc/cp/parser.c > +++ gcc/cp/parser.c > @@ -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); > diff --git gcc/testsuite/g++.dg/cpp2a/typename17.C > gcc/testsuite/g++.dg/cpp2a/typename17.C > new file mode 100644 > index 00000000000..bf534f1717f > --- /dev/null > +++ gcc/testsuite/g++.dg/cpp2a/typename17.C > @@ -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(); > +};