diff options
Diffstat (limited to 'clang/test/Parser/cxx-modules-interface.cppm')
-rw-r--r-- | clang/test/Parser/cxx-modules-interface.cppm | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/clang/test/Parser/cxx-modules-interface.cppm b/clang/test/Parser/cxx-modules-interface.cppm index 88747714e5c..f7835bd167b 100644 --- a/clang/test/Parser/cxx-modules-interface.cppm +++ b/clang/test/Parser/cxx-modules-interface.cppm @@ -1,21 +1,32 @@ -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -DTEST=0 -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -Dmodule=int -DTEST=1 -// RUN: not %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -DTEST=2 2>&1 | FileCheck %s --check-prefix=CHECK-2 -// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -fmodule-file=%t.pcm -o %t.pcm -verify -Dfoo=bar -DTEST=3 +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify +// RUN: %clang_cc1 -std=c++1z -fmodules-ts -emit-module-interface %s -o %t.pcm -verify -Dmodule=int -DERRORS -#if TEST == 0 +module foo; +#ifndef ERRORS // expected-no-diagnostics -#endif +#else +// expected-error@-4 {{expected module declaration at start of module interface}} -module foo; -#if TEST == 1 -// expected-error@-2 {{expected module declaration at start of module interface}} -#elif TEST == 2 -// CHECK-2: error: redefinition of module 'foo' -#endif +// FIXME: support 'export module X;' and 'export { int n; module X; }' +// FIXME: proclaimed-ownership-declarations? + +export { + int a; + int b; +} +export int c; + +namespace N { + export void f() {} +} + +export struct T {} t; -int n; -#if TEST == 3 -// expected-error@-2 {{redefinition of 'n'}} -// expected-note@-3 {{previous}} +struct S { + export int n; // expected-error {{expected member name or ';'}} + export static int n; // expected-error {{expected member name or ';'}} +}; +void f() { + export int n; // expected-error {{expected expression}} +} #endif |