[c++2a] Implement semantic restrictions for 'export' declarations.

llvm-svn: 358932
diff --git a/clang/test/SemaCXX/anonymous-union-export.cpp b/clang/test/SemaCXX/anonymous-union-export.cpp
index 1d83d80..689c6b9 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 c07ee82..1081995 100644
--- a/clang/test/SemaCXX/modules-ts.cppm
+++ b/clang/test/SemaCXX/modules-ts.cppm
@@ -49,8 +49,12 @@
 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 @@
 // 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}}