1 // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.0.pcm -verify -DTEST=0
2 // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.1.pcm -verify -DTEST=1
3 // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.0.pcm -o %t.2.pcm -verify -DTEST=2
4 // RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.0.pcm -o %t.3.pcm -verify -Dfoo=bar -DTEST=3
7 // expected-no-diagnostics
12 // expected-error@-2 {{redefinition of module 'foo'}}
13 // expected-note@modules-ts.cppm:* {{loaded from}}
18 // expected-error@-2 {{redefinition of '}}
19 // expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
20 // FIXME: We should drop the "header from" in this diagnostic.
21 // expected-note-re@modules-ts.cppm:1 {{'{{.*}}modules-ts.cppm' included multiple times, additional include site in header from module 'foo'}}
25 // expected-error@-2 {{redefinition of '}}
26 // expected-note@-3 {{unguarded header; consider using #ifdef guards or #pragma once}}
27 // FIXME: We should drop the "header from" in this diagnostic.
28 // expected-note-re@modules-ts.cppm:1 {{'{{.*}}modules-ts.cppm' included multiple times, additional include site in header from module 'foo'}}
35 constexpr int *p = &n;
46 int use_a = a; // expected-error {{declaration of 'a' must be imported from module 'foo' before it is required}}
47 // expected-note@-14 {{declaration here is not visible}}
52 export {} // expected-error {{export declaration cannot be empty}}
53 export { // expected-note {{begins here}}
54 ; // expected-warning {{ISO C++20 does not permit an empty declaration to appear in an export block}}
56 export { // expected-note {{begins here}}
57 static_assert(true); // expected-warning {{ISO C++20 does not permit a static_assert declaration to appear in an export block}}
61 int use_n = n; // FIXME: this should not be visible, because it is not exported
64 static_assert(&n != p);
69 export int n; // expected-error {{expected member name or ';'}}
70 export static int n; // expected-error {{expected member name or ';'}}
74 // FIXME: Exports of declarations without external linkage are disallowed.
75 // Exports of declarations with non-external-linkage types are disallowed.
77 // Cannot export within another export. This isn't precisely covered by the
78 // language rules right now, but (per personal correspondence between zygoloid
79 // and gdr) is the intent.
81 export { // expected-note {{export block begins here}}
83 namespace NestedExport {
84 export { // expected-error {{appears within another export}}
87 } // namespace NestedExport