summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2019-04-22 22:50:11 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2019-04-22 22:50:11 +0000
commite181de7f4fe9c75327836e5493c2783bcefc9293 (patch)
tree014979d3a317a1d57bcb86609e0d1f11c98ebd55 /clang/test/SemaCXX
parent68602ab2f3535291753a6149d1f445c5fd416152 (diff)
downloadbcm5719-llvm-e181de7f4fe9c75327836e5493c2783bcefc9293.tar.gz
bcm5719-llvm-e181de7f4fe9c75327836e5493c2783bcefc9293.zip
[c++2a] Implement semantic restrictions for 'export' declarations.
llvm-svn: 358932
Diffstat (limited to 'clang/test/SemaCXX')
-rw-r--r--clang/test/SemaCXX/anonymous-union-export.cpp5
-rw-r--r--clang/test/SemaCXX/modules-ts.cppm10
2 files changed, 10 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/anonymous-union-export.cpp b/clang/test/SemaCXX/anonymous-union-export.cpp
index 1d83d809f52..689c6b9f17e 100644
--- a/clang/test/SemaCXX/anonymous-union-export.cpp
+++ b/clang/test/SemaCXX/anonymous-union-export.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++17 -fmodules-ts -emit-obj -verify -o %t.pcm %s
export module M;
-export {
- union { bool a; }; // expected-error{{anonymous unions at namespace or global scope must be declared 'static'}}
+export { // expected-note 2{{export block begins here}}
+ union { bool a; }; // expected-error {{anonymous unions at namespace or global scope must be declared 'static'}} expected-error {{declaration of 'a' with internal linkage cannot be exported}}
+ static union { bool a; }; // expected-error {{declaration of 'a' with internal linkage cannot be exported}}
}
diff --git a/clang/test/SemaCXX/modules-ts.cppm b/clang/test/SemaCXX/modules-ts.cppm
index c07ee82e313..1081995c586 100644
--- a/clang/test/SemaCXX/modules-ts.cppm
+++ b/clang/test/SemaCXX/modules-ts.cppm
@@ -49,8 +49,12 @@ int use_a = a; // expected-error {{declaration of 'a' must be imported from modu
import foo;
export {} // expected-error {{export declaration cannot be empty}}
-export { ; }
-export { static_assert(true); }
+export { // expected-note {{begins here}}
+ ; // expected-warning {{ISO C++20 does not permit an empty declaration to appear in an export block}}
+}
+export { // expected-note {{begins here}}
+ static_assert(true); // expected-warning {{ISO C++20 does not permit a static_assert declaration to appear in an export block}}
+}
int use_b = b;
int use_n = n; // FIXME: this should not be visible, because it is not exported
@@ -74,7 +78,7 @@ struct S {
// language rules right now, but (per personal correspondence between zygoloid
// and gdr) is the intent.
#if TEST == 1
-export {
+export { // expected-note {{export block begins here}}
extern "C++" {
namespace NestedExport {
export { // expected-error {{appears within another export}}
OpenPOWER on IntegriCloud