Douglas Gregor | b80b6a9 | 2011-10-25 03:07:45 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -verify -fsyntax-only -Wc++11-compat |
Richard Smith | 98d86b9 | 2011-10-11 19:57:52 +0000 | [diff] [blame] | 2 | |
Richard Smith | 0c91cce | 2011-10-11 21:51:31 +0000 | [diff] [blame] | 3 | #define constexpr const |
| 4 | constexpr int x = 0; |
| 5 | #undef constexpr |
Richard Smith | 98d86b9 | 2011-10-11 19:57:52 +0000 | [diff] [blame] | 6 | |
| 7 | namespace lib { |
| 8 | struct nullptr_t; |
| 9 | typedef nullptr_t nullptr; // expected-warning {{'nullptr' is a keyword in C++11}} |
| 10 | } |
| 11 | |
| 12 | #define CONCAT(X,Y) CONCAT2(X,Y) |
| 13 | #define CONCAT2(X,Y) X ## Y |
| 14 | int CONCAT(constexpr,ession); |
| 15 | |
| 16 | #define ID(X) X |
| 17 | extern int ID(decltype); // expected-warning {{'decltype' is a keyword in C++11}} |
| 18 | |
| 19 | extern int CONCAT(align,of); // expected-warning {{'alignof' is a keyword in C++11}} |
| 20 | |
| 21 | #define static_assert(b, s) int CONCAT(check, __LINE__)[(b) ? 1 : 0]; |
| 22 | static_assert(1 > 0, "hello"); // ok |
| 23 | |
| 24 | #define IF_CXX11(CXX11, CXX03) CXX03 |
| 25 | typedef IF_CXX11(char16_t, wchar_t) my_wide_char_t; // ok |
| 26 | |
| 27 | int alignas; // expected-warning {{'alignas' is a keyword in C++11}} |
| 28 | int alignof; // already diagnosed in this TU |
| 29 | int char16_t; // expected-warning {{'char16_t' is a keyword in C++11}} |
| 30 | int char32_t; // expected-warning {{'char32_t' is a keyword in C++11}} |
| 31 | int constexpr; // expected-warning {{'constexpr' is a keyword in C++11}} |
| 32 | int decltype; // already diagnosed in this TU |
| 33 | int noexcept; // expected-warning {{'noexcept' is a keyword in C++11}} |
| 34 | int nullptr; // already diagnosed in this TU |
| 35 | int static_assert; // expected-warning {{'static_assert' is a keyword in C++11}} |
| 36 | int thread_local; // expected-warning {{'thread_local' is a keyword in C++11}} |