annotate clang/test/Parser/backtrack-off-by-one.cpp @ 150:1d019706d866

LLVM10
author anatofuz
date Thu, 13 Feb 2020 15:10:13 +0900
parents
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -verify %s -std=c++98
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -verify %s -std=c++11
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -verify %s -std=c++1z
anatofuz
parents:
diff changeset
5
anatofuz
parents:
diff changeset
6 // PR25946
anatofuz
parents:
diff changeset
7 // We had an off-by-one error in an assertion when annotating A<int> below. Our
anatofuz
parents:
diff changeset
8 // error recovery checks if A<int> is a constructor declarator, and opens a
anatofuz
parents:
diff changeset
9 // TentativeParsingAction. Then we attempt to annotate the token at the exact
anatofuz
parents:
diff changeset
10 // position that we want to possibly backtrack to, and this used to crash.
anatofuz
parents:
diff changeset
11
anatofuz
parents:
diff changeset
12 template <typename T> class A {};
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 // expected-error@+1 {{expected '{' after base class list}}
anatofuz
parents:
diff changeset
15 template <typename T> class B : T // not ',' or '{'
anatofuz
parents:
diff changeset
16 #if __cplusplus < 201103L
anatofuz
parents:
diff changeset
17 // expected-error@+8 {{expected ';' after top level declarator}}
anatofuz
parents:
diff changeset
18 #endif
anatofuz
parents:
diff changeset
19 #if __cplusplus <= 201402L
anatofuz
parents:
diff changeset
20 // expected-error@+5 {{C++ requires a type specifier for all declarations}}
anatofuz
parents:
diff changeset
21 #else
anatofuz
parents:
diff changeset
22 // expected-error@+3 {{expected unqualified-id}}
anatofuz
parents:
diff changeset
23 #endif
anatofuz
parents:
diff changeset
24 // expected-error@+1 {{expected ';' after class}}
anatofuz
parents:
diff changeset
25 A<int> {
anatofuz
parents:
diff changeset
26 };