[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Parser / backtrack-off-by-one.cpp
blobb5c05aeee9d93351f63f5c5a3410374f4915231e
1 // RUN: %clang_cc1 -verify %s
2 // RUN: %clang_cc1 -verify %s -std=c++98
3 // RUN: %clang_cc1 -verify %s -std=c++11
4 // RUN: %clang_cc1 -verify %s -std=c++1z
6 // PR25946
7 // We had an off-by-one error in an assertion when annotating A<int> below. Our
8 // error recovery checks if A<int> is a constructor declarator, and opens a
9 // TentativeParsingAction. Then we attempt to annotate the token at the exact
10 // position that we want to possibly backtrack to, and this used to crash.
12 template <typename T> class A {};
14 // expected-error@+1 {{expected '{' after base class list}}
15 template <typename T> class B : T // not ',' or '{'
16 #if __cplusplus < 201103L
17 // expected-error@+8 {{expected ';' after top level declarator}}
18 #endif
19 #if __cplusplus <= 201402L
20 // expected-error@+5 {{a type specifier is required for all declarations}}
21 #else
22 // expected-error@+3 {{expected unqualified-id}}
23 #endif
24 // expected-error@+1 {{expected ';' after class}}
25 A<int> {