Message ID | 20210915040452.957026-1-jason@redhat.com |
---|---|
State | New |
Headers | show |
Series | [pushed] c++: tweak C++20 destructor template-id rule | expand |
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index e44c5c6b57c..ab1dc81b997 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -6379,7 +6379,8 @@ cp_parser_unqualified_id (cp_parser* parser, /* DR 2237 (C++20 only): A simple-template-id is no longer valid as the declarator-id of a constructor or destructor. */ - if (token->type == CPP_TEMPLATE_ID && cxx_dialect >= cxx20) + if (token->type == CPP_TEMPLATE_ID && declarator_p + && cxx_dialect >= cxx20) { if (!cp_parser_simulate_error (parser)) error_at (tilde_loc, "template-id not allowed for destructor");