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
4
3
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
6
7
7
- #ifdef ERRORS
8
+ // --- errors.cpp
9
+ module ;
8
10
export 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;
20
12
export int b; // #1
21
13
namespace N {
22
14
export int c; // #2
23
15
}
24
16
25
- #ifdef ERRORS
26
17
namespace { // expected-note 2{{anonymous namespace begins here}}
27
18
export int d1; // expected-error {{export declaration appears within anonymous namespace}}
28
19
namespace X {
@@ -35,4 +26,19 @@ export { export int f; } // expected-error {{within another export declaration}}
35
26
36
27
module :private; // expected-note {{private module fragment begins here}}
37
28
export 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