Richard Smith b3f6e3d6d6 Improve recovery from invalid template-ids.
Instead of bailing out of parsing when we encounter an invalid
template-name or template arguments in a template-id, produce an
annotation token describing the invalid construct.

This avoids duplicate errors and generally allows us to recover better.
In principle we should be able to extend this to store some kinds of
invalid template-id in the AST for tooling use, but that isn't handled
as part of this change.
2020-03-27 17:11:04 -07:00

17 lines
489 B
C++

// RUN: not %clang_cc1 %s -fsyntax-only 2>&1 | FileCheck %s
// CHECK: error: expected expression
// CHECK: error: expected '>'
// CHECK: error: expected member name or ';' after declaration specifiers
// CHECK: error: expected '}'
// CHECK: note: to match this '{'
// CHECK: error: expected ';' after class
// CHECK: 5 errors generated.
// Do not add anything to the end of this file. This requires the whitespace
// plus EOF after the '<' token.
template <typename T>
class a {
a<