1// RUN: %clang_cc1 -std=c++20 %s -verify -emit-module-interface -o /dev/null 2// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -verify -emit-module-interface -o %t 3// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -verify -fmodule-file=A=%t -o /dev/null 4// 5// RUN: %clang_cc1 -std=c++20 %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null 6// RUN: %clang_cc1 -std=c++20 %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null 7// RUN: %clang_cc1 -std=c++20 %s -DIMPLEMENTATION -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null 8 9#if INTERFACE 10// expected-no-diagnostics 11export module A; 12#elif IMPLEMENTATION 13module A; // #module-decl 14 #ifdef BUILT_AS_INTERFACE 15 // expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}} 16 #define INTERFACE 17 #endif 18#else // Not in a module 19// expected-error@* {{missing 'export module' declaration in module interface unit}} 20#endif 21 22#ifndef INTERFACE 23export int b; // expected-error {{export declaration can only be used within a module purview}} 24#ifdef IMPLEMENTATION 25// expected-note@#module-decl {{add 'export' here}} 26#endif 27#else 28export int a; 29#endif 30