Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / module / module.interface / p1.cpp
blob54a201e5023230ead39f965ee846929427d4c9f5
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
5 module;
7 #ifdef ERRORS
8 export int a; // expected-error {{export declaration can only be used within a module purview}}
9 #endif
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;
20 export int b; // #1
21 namespace N {
22 export int c; // #2
25 #ifdef ERRORS
26 namespace { // expected-note 2{{anonymous namespace begins here}}
27 export int d1; // expected-error {{export declaration appears within anonymous namespace}}
28 namespace X {
29 export int d2; // expected-error {{export declaration appears within anonymous namespace}}
33 export export int e; // expected-error {{within another export declaration}}
34 export { export int f; } // expected-error {{within another export declaration}} expected-note {{export block begins here}}
36 module :private; // expected-note {{private module fragment begins here}}
37 export int priv; // expected-error {{export declaration cannot be used in a private module fragment}}
38 #endif