| 1 |
// Based on C++20 10.2 example 6. |
| 2 |
|
| 3 |
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -verify -o %t |
| 4 |
|
| 5 |
export module M; |
| 6 |
|
| 7 |
static int f(); // expected-note {{previous declaration is here}} #1 |
| 8 |
// error: #1 gives internal linkage |
| 9 |
export int f(); // expected-error {{cannot export redeclaration 'f' here since the previous declaration has internal linkage}} |
| 10 |
struct S; // expected-note {{previous declaration is here}} #2 |
| 11 |
// error: #2 gives module linkage |
| 12 |
export struct S; // expected-error {{cannot export redeclaration 'S' here since the previous declaration has module linkage}} |
| 13 |
|
| 14 |
namespace { |
| 15 |
namespace N { |
| 16 |
extern int x; // expected-note {{previous declaration is here}} #3 |
| 17 |
} |
| 18 |
} // namespace |
| 19 |
// error: #3 gives internal linkage |
| 20 |
export int N::x; // expected-error {{cannot export redeclaration 'x' here since the previous declaration has internal linkage}} |
| 21 |
// expected-error@-1 {{declaration of 'x' with internal linkage cannot be exported}} |