+2020-03-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94336 - template keyword accepted before destructor names.
+ * parser.c (cp_parser_unqualified_id): Give an error when 'template'
+ is followed by a destructor name.
+
2020-03-27 Patrick Palka <ppalka@redhat.com>
* decl.c (compute_array_index_type_loc): Remove redundant
cp_lexer_consume_token (parser->lexer);
return error_mark_node;
}
+ if (template_keyword_p)
+ {
+ if (!cp_parser_uncommitted_to_tentative_parse_p (parser))
+ error_at (tilde_loc, "%<template%> keyword not permitted in "
+ "destructor name");
+ cp_parser_simulate_error (parser);
+ return error_mark_node;
+ }
+
gcc_assert (!scope || TYPE_P (scope));
token = cp_lexer_peek_token (parser->lexer);
+2020-03-26 Marek Polacek <polacek@redhat.com>
+
+ PR c++/94336 - template keyword accepted before destructor names.
+ * g++.dg/template/template-keyword2.C: New test.
+
2020-03-27 Iain Sandoe <iain@sandoe.co.uk>
* g++.dg/coroutines/torture/symmetric-transfer-00-basic.C:
--- /dev/null
+// PR c++/94336 - template keyword accepted before destructor names.
+
+template<typename T> void f(T *p) { p->template ~X(); } // { dg-error ".template. keyword not permitted in destructor name" }
+template<typename T> struct X {};
+void g(X<int> *p) { f(p); }