File tree Expand file tree Collapse file tree 1 file changed +24
-18
lines changed
clang/test/CXX/module/module.interface Expand file tree Collapse file tree 1 file changed +24
-18
lines changed Original file line number Diff line number Diff line change 1- // RUN: %clang_cc1 -std=c++2a %s -DERRORS -verify
2- // RUN: %clang_cc1 -std=c++2a %s -emit-module-interface -o %t.pcm
3- // RUN: %clang_cc1 -std=c++2a %s -fmodule-file=M=%t.pcm -DIMPLEMENTATION -verify -Db=b2 -Dc=c2
1+ // RUN: rm -rf %t
2+ // RUN: split-file %s %t
43
5- module ;
4+ // RUN: %clang_cc1 -std=c++2a %t/errors.cpp -verify
5+ // RUN: %clang_cc1 -std=c++2a %t/M.cppm -emit-module-interface -o %t/M.pcm
6+ // RUN: %clang_cc1 -std=c++2a %t/impl.cpp -fmodule-file=M=%t/M.pcm -verify
67
7- #ifdef ERRORS
8+ // --- errors.cpp
9+ module ;
810export int a; // expected-error {{export declaration can only be used within a module purview}}
9- #endif
10-
11- #ifndef IMPLEMENTATION
12- export
13- #else
14- // expected-error@#1 {{export declaration can only be used within a module purview}}
15- // expected-error@#2 {{export declaration can only be used within a module purview}}
16- // expected-note@+2 1+{{add 'export'}}
17- #endif
18- module M;
19-
11+ export module M;
2012export int b; // #1
2113namespace N {
2214 export int c; // #2
2315}
2416
25- #ifdef ERRORS
2617namespace { // expected-note 2{{anonymous namespace begins here}}
2718 export int d1; // expected-error {{export declaration appears within anonymous namespace}}
2819 namespace X {
@@ -35,4 +26,19 @@ export { export int f; } // expected-error {{within another export declaration}}
3526
3627module :private; // expected-note {{private module fragment begins here}}
3728export int priv; // expected-error {{export declaration cannot be used in a private module fragment}}
38- #endif
29+
30+ // --- M.cppm
31+ export module M;
32+ export int b;
33+ namespace N {
34+ export int c;
35+ }
36+
37+ // --- impl.cpp
38+ module M; // #M
39+
40+ export int b2; // expected-error {{export declaration can only be used within a module purview}}
41+ namespace N {
42+ export int c2; // expected-error {{export declaration can only be used within a module purview}}
43+ }
44+ // expected-note@#M 2+{{add 'export'}}
You can’t perform that action at this time.
0 commit comments