brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1009 B · 749b152 Raw
32 lines · cpp
1// Based on C++20 10.2 example 1.2 3// RUN: rm -rf %t4// RUN: mkdir -p %t5// RUN: split-file %s %t6 7// RUN: %clang_cc1 -std=c++20 -emit-module-interface %t/std-10-2-ex1-tu1.cpp \8// RUN: -pedantic-errors -verify -o %t/m1.pcm9 10//--- std-10-2-ex1.h11export int x;12 13//--- std-10-2-ex1-tu1.cpp14module;15 16#include "std-10-2-ex1.h"17// expected-error@std-10-2-ex1.h:* {{export declaration can only be used within a module interface}}18 19export module M1;20export namespace {} // expected-error {{anonymous namespaces cannot be exported}}21export namespace { // expected-error {{anonymous namespaces cannot be exported}}22int a1;23}24namespace {    // expected-note {{anonymous namespace begins here}}25export int a2; // expected-error {{export declaration appears within anonymous namespace}}26}27export static int b; // expected-error {{declaration of 'b' with internal linkage cannot be exported}}28export int f();      // OK29 30export namespace N {}     // namespace N31export using namespace N; // No diagnostic after P2615R1 DR32