cxx0x_keyword_as_cxx98.cpp revision c2c11446caaee2d5a787cc8d0310330c6364210d
1// RUN: %clang_cc1 %s -verify -fsyntax-only -Wc++11-compat
2
3#define constexpr const
4constexpr int x = 0;
5#undef constexpr
6
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 ## Y
14int CONCAT(constexpr,ession);
15
16#define ID(X) X
17extern 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"); // ok
23
24#define IF_CXX11(CXX11, CXX03) CXX03
25typedef IF_CXX11(char16_t, wchar_t) my_wide_char_t; // ok
26
27int alignas; // expected-warning {{'alignas' is a keyword in C++11}}
28int alignof; // already diagnosed in this TU
29int 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 TU
33int noexcept; // expected-warning {{'noexcept' is a keyword in C++11}}
34int nullptr; // already diagnosed in this TU
35int 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