| 1 |
// RUN: %clang_cc1 -fmodules %s -verify |
| 2 |
// expected-no-diagnostics |
| 3 |
|
| 4 |
#pragma clang module build A |
| 5 |
module A {} |
| 6 |
#pragma clang module contents |
| 7 |
#pragma clang module begin A |
| 8 |
namespace N { class X; } |
| 9 |
#pragma clang module end |
| 10 |
#pragma clang module endbuild |
| 11 |
|
| 12 |
#pragma clang module build B |
| 13 |
module B {} |
| 14 |
#pragma clang module contents |
| 15 |
#pragma clang module begin B |
| 16 |
namespace N { class Friendly { friend class X; }; } |
| 17 |
#pragma clang module end |
| 18 |
#pragma clang module endbuild |
| 19 |
|
| 20 |
#pragma clang module build C |
| 21 |
module C {} |
| 22 |
#pragma clang module contents |
| 23 |
#pragma clang module begin C |
| 24 |
#pragma clang module import A |
| 25 |
void use_X(N::X *p); |
| 26 |
#pragma clang module import B |
| 27 |
// UsingShadowDecl names the friend declaration |
| 28 |
using N::X; |
| 29 |
#pragma clang module end |
| 30 |
#pragma clang module endbuild |
| 31 |
|
| 32 |
#pragma clang module import B |
| 33 |
namespace N { class AlsoFriendly { friend class X; }; } |
| 34 |
#pragma clang module import A |
| 35 |
#pragma clang module import C |
| 36 |
// The friend declaration from N::Friendly is now the first in the redecl |
| 37 |
// chain, so is not ordinarily visible. We need the IDNS of the UsingShadowDecl |
| 38 |
// to still consider it to be visible, though. |
| 39 |
X *p; |