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}}
17 // expected-warning@+2 {{inline nested namespace definition is incompatible with C++ standards before C++20}}
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}}
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}}
34 // expected-warning@+2 {{inline nested namespace definition is incompatible with C++ standards before C++20}}
36 namespace valid1::valid2::inline valid3::inline valid4::valid5
{}
40 //expected-warning@+1 {{inline namespace reopened as a non-inline namespace}}
42 //expected-warning@+1 {{inline namespace reopened as a non-inline namespace}}