+2018-11-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/87781 - detect invalid elaborated-type-specifier.
+ * parser.c (cp_parser_elaborated_type_specifier): Ensure that
+ typename follows a nested-name-specifier.
+
2018-11-18 Paolo Carlini <paolo.carlini@oracle.com>
* decl2.c (grokfield): Remove obsolete _vptr check; fix
template-id or not. */
if (!template_p)
cp_parser_parse_tentatively (parser);
+ /* The `template' keyword must follow a nested-name-specifier. */
+ else if (!nested_name_specifier)
+ {
+ cp_parser_error (parser, "%<template%> must follow a nested-"
+ "name-specifier");
+ return error_mark_node;
+ }
+
/* Parse the template-id. */
token = cp_lexer_peek_token (parser->lexer);
decl = cp_parser_template_id (parser, template_p,
+2018-11-19 Marek Polacek <polacek@redhat.com>
+
+ PR c++/87781 - detect invalid elaborated-type-specifier.
+ * g++.dg/parse/elab3.C: New test.
+ * g++.dg/template/crash115.C: Adjust dg-error.
+
2018-11-19 Peter Bergner <bergner@linux.ibm.com>
PR rtl-optimization/88033
--- /dev/null
+// PR c++/87781
+// { dg-do compile }
+// { dg-options "" }
+
+template<class> class A;
+class template A<int> *p; // { dg-error ".template. must follow|invalid" }
// PR c++/56534
-template < struct template rebind < > // { dg-error "expected" }
+template < struct template rebind < > // { dg-error "expected|must follow" }