| 1 |
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s |
| 2 |
|
| 3 |
// FIXME: We should probably suppress the warning on reopening an inline |
| 4 |
// namespace without the inline keyword if it's not the first opening of the |
| 5 |
// namespace in the file, because there's no risk of the inlineness differing |
| 6 |
// across TUs in that case. |
| 7 |
|
| 8 |
namespace NIL {} // expected-note {{previous definition}} |
| 9 |
inline namespace NIL {} // expected-error {{cannot be reopened as inline}} |
| 10 |
inline namespace IL {} // expected-note {{previous definition}} |
| 11 |
namespace IL {} // expected-warning{{inline namespace reopened as a non-inline namespace}} |
| 12 |
|
| 13 |
namespace {} // expected-note {{previous definition}} |
| 14 |
inline namespace {} // expected-error {{cannot be reopened as inline}} |
| 15 |
namespace X { |
| 16 |
inline namespace {} // expected-note {{previous definition}} |
| 17 |
namespace {} // expected-warning {{inline namespace reopened as a non-inline namespace}} |
| 18 |
} |
| 19 |
|
| 20 |
namespace std {} |
| 21 |
inline namespace std {} // expected-error{{cannot declare the namespace 'std' to be inline}} |
| 22 |
inline namespace std::foo {} // expected-error{{cannot declare the namespace 'std' to be inline}} |
| 23 |
// expected-error@-1{{nested namespace definition cannot be 'inline'}} |
| 24 |
namespace foo::inline std {} // expected-note {{previous definition}} |
| 25 |
namespace foo { inline namespace std {} } // OK |
| 26 |
namespace foo { namespace std {} } // expected-warning {{inline namespace reopened as a non-inline namespace}} |