Debian Codegraph @

clang/test/CXX/module/dcl.dcl/dcl.module/dcl.module.interface/p1.cppm

raw
1 // RUN: rm -rf %t
2 // RUN: split-file %s %t
3
4 // RUN: %clang_cc1 -std=c++20 %t/ExportDeclNotInModulePurview.cppm -verify -emit-module-interface -o /dev/null
5 // RUN: %clang_cc1 -std=c++20 %t/A.cppm -verify -emit-module-interface -o %t/A.pcm
6 // RUN: %clang_cc1 -std=c++20 %t/AddExport.cppm -verify -fmodule-file=A=%t/A.pcm -o /dev/null
7 //
8 // RUN: %clang_cc1 -std=c++20 %t/AddExport2.cppm -emit-module-interface -verify -o /dev/null
9
10 //--- ExportDeclNotInModulePurview.cppm
11 // expected-error@* {{missing 'export module' declaration in module interface unit}}
12 export int b; // expected-error {{export declaration can only be used within a module interface}}
13
14 //--- A.cppm
15 // expected-no-diagnostics
16 export module A;
17 export int a;
18
19 //--- AddExport.cppm
20 module A; // #module-decl
21 export int b; // expected-error {{export declaration can only be used within a module interface}}
22 // expected-note@#module-decl {{add 'export' here}}
23
24 //--- AddExport2.cppm
25 module A; // expected-error {{missing 'export' specifier in module declaration while building module interface}}
26 export int a;