summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.interface/p1.cpp
blob: afe3a7a48589c01ad3845a44604f7cc13c21a8e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// RUN: %clang_cc1 -fmodules-ts %s -verify -o /dev/null
// RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -verify -o /dev/null
// RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -verify -o /dev/null
//
// RUN: %clang_cc1 -fmodules-ts %s -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
// RUN: %clang_cc1 -fmodules-ts %s -DINTERFACE -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null
// RUN: %clang_cc1 -fmodules-ts %s -DIMPLEMENTATION -DBUILT_AS_INTERFACE -emit-module-interface -verify -o /dev/null

#if INTERFACE
export module A;
#elif IMPLEMENTATION
module A;
 #ifdef BUILT_AS_INTERFACE
  // expected-error@-2 {{missing 'export' specifier in module declaration while building module interface}}
 #endif
#else
 #ifdef BUILT_AS_INTERFACE
  // FIXME: Diagnose missing module declaration (at end of TU)
 #endif
#endif

export int a;
#ifndef INTERFACE
// expected-error@-2 {{export declaration can only be used within a module interface unit}}
#else
// expected-no-diagnostics
#endif
OpenPOWER on IntegriCloud