37 lines · cpp
1// RUN: %clang_cc1 %s -verify -fsyntax-only -Wc++11-compat -std=c++982 3#define constexpr const4constexpr int x = 0;5#undef constexpr6 7namespace 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 ## Y14int CONCAT(constexpr,ession);15 16#define ID(X) X17extern int ID(decltype); // expected-warning {{'decltype' is a keyword in C++11}}18 19extern 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];22static_assert(1 > 0, "hello"); // ok23 24#define IF_CXX11(CXX11, CXX03) CXX0325typedef IF_CXX11(char16_t, wchar_t) my_wide_char_t; // ok26 27int alignas; // expected-warning {{'alignas' is a keyword in C++11}}28int alignof; // already diagnosed in this TU29int char16_t; // expected-warning {{'char16_t' is a keyword in C++11}}30int char32_t; // expected-warning {{'char32_t' is a keyword in C++11}}31int constexpr; // expected-warning {{'constexpr' is a keyword in C++11}}32int decltype; // already diagnosed in this TU33int noexcept; // expected-warning {{'noexcept' is a keyword in C++11}}34int nullptr; // already diagnosed in this TU35int static_assert; // expected-warning {{'static_assert' is a keyword in C++11}}36int thread_local; // expected-warning {{'thread_local' is a keyword in C++11}}37