diff options
author | Jordan Rupprecht <[email protected]> | 2019-05-14 21:58:59 +0000 |
---|---|---|
committer | Jordan Rupprecht <[email protected]> | 2019-05-14 21:58:59 +0000 |
commit | b35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch) | |
tree | cdff4a5d1a715d4ad622fd8f190128b54bebe440 /test/CXX/module/module.interface/p3.cpp | |
parent | 3748d41833787fcbf59cc5624e8d2b042a8991bc (diff) | |
parent | 741e05796da92b46d4f7bcbee00702ff37df6489 (diff) |
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/module/module.interface/p3.cpp')
-rw-r--r-- | test/CXX/module/module.interface/p3.cpp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/test/CXX/module/module.interface/p3.cpp b/test/CXX/module/module.interface/p3.cpp new file mode 100644 index 0000000000..29d2cb43b4 --- /dev/null +++ b/test/CXX/module/module.interface/p3.cpp @@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -std=c++2a %s -verify -pedantic-errors + +export module p3; + +namespace A { int ns_mem; } + +// An exported declaration shall declare at least one name. +export; // expected-error {{empty declaration cannot be exported}} +export static_assert(true); // expected-error {{static_assert declaration cannot be exported}} +export using namespace A; // expected-error {{ISO C++20 does not permit using directive to be exported}} + +export { // expected-note 3{{export block begins here}} + ; // expected-error {{ISO C++20 does not permit an empty declaration to appear in an export block}} + static_assert(true); // expected-error {{ISO C++20 does not permit a static_assert declaration to appear in an export block}} + using namespace A; // expected-error {{ISO C++20 does not permit using directive to be exported}} +} + +export struct {}; // expected-error {{must be class member}} expected-error {{GNU extension}} expected-error {{does not declare anything}} +export struct {} struct_; +export union {}; // expected-error {{must be declared 'static'}} expected-error {{does not declare anything}} +export union {} union_; +export enum {}; // expected-error {{does not declare anything}} +export enum {} enum_; +export enum E : int; +export typedef int; // expected-error {{typedef requires a name}} +export static union {}; // expected-error {{does not declare anything}} +export asm(""); // expected-error {{asm declaration cannot be exported}} +export namespace B = A; +export using A::ns_mem; +namespace A { + export using A::ns_mem; +} +export using Int = int; +export extern "C++" {} // expected-error {{ISO C++20 does not permit a declaration that does not introduce any names to be exported}} +export extern "C++" { extern "C" {} } // expected-error {{ISO C++20 does not permit a declaration that does not introduce any names to be exported}} +export extern "C++" { extern "C" int extern_c; } +export { // expected-note {{export block}} + extern "C++" int extern_cxx; + extern "C++" {} // expected-error {{ISO C++20 does not permit a declaration that does not introduce any names to be exported}} +} +export [[]]; // FIXME (bad diagnostic text): expected-error {{empty declaration cannot be exported}} +export [[example::attr]]; // FIXME: expected-error {{empty declaration cannot be exported}} expected-warning {{unknown attribute 'attr'}} + +// [...] shall not declare a name with internal linkage +export static int a; // expected-error {{declaration of 'a' with internal linkage cannot be exported}} +export static int b(); // expected-error {{declaration of 'b' with internal linkage cannot be exported}} +export namespace { int c; } // expected-error {{declaration of 'c' with internal linkage cannot be exported}} +namespace { // expected-note {{here}} + export int d; // expected-error {{export declaration appears within anonymous namespace}} +} +export template<typename> static int e; // expected-error {{declaration of 'e' with internal linkage cannot be exported}} +export template<typename> static int f(); // expected-error {{declaration of 'f' with internal linkage cannot be exported}} +export const int k = 5; +export static union { int n; }; // expected-error {{declaration of 'n' with internal linkage cannot be exported}} |