Reid Kleckner | ae81850 | 2016-10-20 20:53:20 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify %s |
Paul Robinson | 80ba292 | 2016-12-21 18:33:17 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 -verify %s -std=c++98 |
| 3 | // RUN: %clang_cc1 -verify %s -std=c++11 |
Richard Smith | 600b526 | 2017-01-26 20:40:47 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 -verify %s -std=c++1z |
Reid Kleckner | ae81850 | 2016-10-20 20:53:20 +0000 | [diff] [blame] | 5 | |
| 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. |
| 11 | |
| 12 | template <typename T> class A {}; |
| 13 | |
| 14 | // expected-error@+1 {{expected '{' after base class list}} |
| 15 | template <typename T> class B : T // not ',' or '{' |
Paul Robinson | 80ba292 | 2016-12-21 18:33:17 +0000 | [diff] [blame] | 16 | #if __cplusplus < 201103L |
Richard Smith | 600b526 | 2017-01-26 20:40:47 +0000 | [diff] [blame] | 17 | // expected-error@+8 {{expected ';' after top level declarator}} |
Paul Robinson | 80ba292 | 2016-12-21 18:33:17 +0000 | [diff] [blame] | 18 | #endif |
Richard Smith | 600b526 | 2017-01-26 20:40:47 +0000 | [diff] [blame] | 19 | #if __cplusplus <= 201402L |
| 20 | // expected-error@+5 {{C++ requires a type specifier for all declarations}} |
| 21 | #else |
| 22 | // expected-error@+3 {{expected unqualified-id}} |
| 23 | #endif |
Reid Kleckner | ae81850 | 2016-10-20 20:53:20 +0000 | [diff] [blame] | 24 | // expected-error@+1 {{expected ';' after class}} |
| 25 | A<int> { |
| 26 | }; |