brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 1754d9e Raw
45 lines · cpp
1// RUN: rm -rf %t2// RUN: split-file %s %t3 4// RUN: %clang_cc1 -std=c++2a %t/errors.cpp -verify5// RUN: %clang_cc1 -std=c++2a %t/M.cppm -emit-module-interface -o %t/M.pcm6// RUN: %clang_cc1 -std=c++2a %t/impl.cpp -fmodule-file=M=%t/M.pcm -verify7 8//--- errors.cpp9module;10export int a; // expected-error {{export declaration can only be used within a module interface}}11export module M;12export int b; // #113namespace N {14  export int c; // #215}16 17namespace { // expected-note 2{{anonymous namespace begins here}}18  export int d1; // expected-error {{export declaration appears within anonymous namespace}}19  namespace X {20    export int d2; // expected-error {{export declaration appears within anonymous namespace}}21  }22}23 24export export int e; // expected-error {{within another export declaration}}25export { export int f; } // expected-error {{within another export declaration}} expected-note {{export block begins here}}26 27module :private; // expected-note {{private module fragment begins here}}28export int priv; // expected-error {{export declaration cannot be used in a private module fragment}}29 30//--- M.cppm31export module M;32export int b;33namespace N {34  export int c;35}36 37//--- impl.cpp38module M; // #M39 40export int b2; // expected-error {{export declaration can only be used within a module interface}}41namespace N {42  export int c2; // expected-error {{export declaration can only be used within a module interface}}43}44// expected-note@#M 2+{{add 'export'}}45