diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /test/Modules/using-decl-friend-2.cpp | |
parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) |
Notes
Diffstat (limited to 'test/Modules/using-decl-friend-2.cpp')
-rw-r--r-- | test/Modules/using-decl-friend-2.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/test/Modules/using-decl-friend-2.cpp b/test/Modules/using-decl-friend-2.cpp new file mode 100644 index 0000000000000..0c71c37765f3b --- /dev/null +++ b/test/Modules/using-decl-friend-2.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -fmodules %s -verify +// expected-no-diagnostics + +#pragma clang module build A +module A {} +#pragma clang module contents +#pragma clang module begin A +namespace N { class X; } +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module build B +module B {} +#pragma clang module contents +#pragma clang module begin B +namespace N { class Friendly { friend class X; }; } +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module build C +module C {} +#pragma clang module contents +#pragma clang module begin C +#pragma clang module import A +void use_X(N::X *p); +#pragma clang module import B +// UsingShadowDecl names the friend declaration +using N::X; +#pragma clang module end +#pragma clang module endbuild + +#pragma clang module import B +namespace N { class AlsoFriendly { friend class X; }; } +#pragma clang module import A +#pragma clang module import C +// The friend declaration from N::Friendly is now the first in the redecl +// chain, so is not ordinarily visible. We need the IDNS of the UsingShadowDecl +// to still consider it to be visible, though. +X *p; |