[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Parser / cxx2a-inline-nested-namespace-definition.cpp
blob72a0cbf8da8f1580991533c45cbab8c80d533de0
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14
2 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++17
3 // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++20 -Wc++17-compat
5 namespace inline foo1::foo2::foo3 { // expected-error {{expected identifier or '{'}} expected-error {{use of undeclared identifier 'foo1'}}
8 inline namespace foo4::foo5::foo6 { // expected-error {{nested namespace definition cannot be 'inline'}}}
11 #if __cplusplus <= 201402L
12 // expected-warning@+7 {{nested namespace definition is a C++17 extension; define each namespace separately}}
13 // expected-warning@+6 {{inline nested namespace definition is a C++20 extension}}
14 #elif __cplusplus <= 201703L
15 // expected-warning@+4 {{inline nested namespace definition is a C++20 extension}}
16 #else
17 // expected-warning@+2 {{inline nested namespace definition is incompatible with C++ standards before C++20}}
18 #endif
19 namespace valid1::valid2::inline valid3::inline valid4::valid5 {}
20 // expected-note@-1 4 {{previous definition is here}}
22 #if __cplusplus <= 201402L
23 // expected-warning@+3 {{nested namespace definition is a C++17 extension; define each namespace separately}}
24 #endif
25 //expected-warning@+1 2 {{inline namespace reopened as a non-inline namespace}}
26 namespace valid1::valid2::valid3::valid4::valid5 {}
28 #if __cplusplus <= 201402L
29 // expected-warning@+7 {{nested namespace definition is a C++17 extension; define each namespace separately}}
30 // expected-warning@+6 {{inline nested namespace definition is a C++20 extension}}
31 #elif __cplusplus <= 201703L
32 // expected-warning@+4 {{inline nested namespace definition is a C++20 extension}}
33 #else
34 // expected-warning@+2 {{inline nested namespace definition is incompatible with C++ standards before C++20}}
35 #endif
36 namespace valid1::valid2::inline valid3::inline valid4::valid5 {}
38 namespace valid1 {
39 namespace valid2 {
40 //expected-warning@+1 {{inline namespace reopened as a non-inline namespace}}
41 namespace valid3 {
42 //expected-warning@+1 {{inline namespace reopened as a non-inline namespace}}
43 namespace valid4 {
44 namespace valid5 {
46 } // namespace valid4
47 } // namespace valid3
48 } // namespace valid2
49 } // namespace valid1