+2018-03-01 Jason Merrill <jason@redhat.com>
+
+ PR c++/71569 - decltype of template.
+ * parser.c (cp_parser_decltype_expr): Handle missing template args.
+
2018-03-01 Marek Polacek <polacek@redhat.com>
PR c++/84596
expr = cp_parser_lookup_name_simple (parser, expr,
id_expr_start_token->location);
+ if (expr && TREE_CODE (expr) == TEMPLATE_DECL)
+ /* A template without args is not a complete id-expression. */
+ expr = error_mark_node;
+
if (expr
&& expr != error_mark_node
&& TREE_CODE (expr) != TYPE_DECL
expression. */
cp_parser_abort_tentative_parse (parser);
+ /* Commit to the tentative_firewall so we get syntax errors. */
+ cp_parser_commit_to_tentative_parse (parser);
+
/* Parse a full expression. */
expr = cp_parser_expression (parser, /*pidk=*/NULL, /*cast_p=*/false,
/*decltype_p=*/true);
// PR c++/33837
void foo()
{
- __decltype (A::foo()); // { dg-error "was not declared|expected" }
- __decltype (B); // { dg-error "was not declared" }
+ __decltype (A::foo()); // { dg-error "A" }
+ __decltype (B); // { dg-error "B" }
}
int main()
{
int x = B<decltype(A<int>::a(1))>::b(A<int>::a(1));
- int y = B<decltype(A ::a(2))>::b(A<int>::a(2)); // { dg-error "template argument" }
+ int y = B<decltype(A ::a(2))>::b(A<int>::a(2)); // { dg-error "template" }
return x + y;
}