40 lines · cpp
1// RUN: %clang_cc1 -fmodules %s -verify2// expected-no-diagnostics3 4#pragma clang module build A5module A {}6#pragma clang module contents7#pragma clang module begin A8namespace N { class X; }9#pragma clang module end10#pragma clang module endbuild11 12#pragma clang module build B13module B {}14#pragma clang module contents15#pragma clang module begin B16namespace N { class Friendly { friend class X; }; }17#pragma clang module end18#pragma clang module endbuild19 20#pragma clang module build C21module C {}22#pragma clang module contents23#pragma clang module begin C24#pragma clang module import A25void use_X(N::X *p);26#pragma clang module import B27// UsingShadowDecl names the friend declaration28using N::X;29#pragma clang module end30#pragma clang module endbuild31 32#pragma clang module import B33namespace N { class AlsoFriendly { friend class X; }; }34#pragma clang module import A35#pragma clang module import C36// The friend declaration from N::Friendly is now the first in the redecl37// chain, so is not ordinarily visible. We need the IDNS of the UsingShadowDecl38// to still consider it to be visible, though.39X *p;40