1 // RUN: %clang_cc1 -fmodules-ts %s -verify -o /dev/null
2 // RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -verify -o /dev/null
3 // RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -verify -o /dev/null
4 //
5 // RUN: %clang_cc1 -fmodules-ts %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
6 // RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
7 // RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
8 
9 #if INTERFACE
10 export module A;
11 #elif IMPLEMENTATION
12 module A;
13  #ifdef BUILT_AS_INTERFACE
14   // expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}}
15  #endif
16 #else
17  #ifdef BUILT_AS_INTERFACE
18   // FIXME: Diagnose missing module declaration (at end of TU)
19  #endif
20 #endif
21 
22 export int a;
23 #ifndef INTERFACE
24 // expected-error@-2 {{export declaration can only be used within a module interface unit}}
25 #else
26 // expected-no-diagnostics
27 #endif
28