22 lines · cpp
1// Based on C++20 10.2 example 6.2 3// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -verify -o %t4 5export module M;6 7static int f(); // expected-note {{previous declaration is here}} #18 // error: #1 gives internal linkage9export int f(); // expected-error {{cannot export redeclaration 'f' here since the previous declaration has internal linkage}}10struct S; // expected-note {{previous declaration is here}} #211 // error: #2 gives module linkage12export struct S; // expected-error {{cannot export redeclaration 'S' here since the previous declaration has module linkage}}13 14namespace {15namespace N {16extern int x; // expected-note {{previous declaration is here}} #317}18} // namespace19 // error: #3 gives internal linkage20export int N::x; // expected-error {{cannot export redeclaration 'x' here since the previous declaration has internal linkage}}21 // expected-error@-1 {{declaration of 'x' with internal linkage cannot be exported}}22