From 9324d169bd334f051dc6110be7d27772c21eb21e Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 15 Jul 2013 17:27:42 +0000 Subject: Re-revert r86040, which was un-reverted in r186199. This breaks the build of basic patterns with repeated friend declarations. See the added test case in SemaCXX/friend.cpp or the test case reported to the original commit log. Original commit log: If we friend a declaration twice, that should not make it visible to name lookup in the surrounding context. Slightly rework how we handle friend declarations to inherit the visibility of the prior declaration, rather than setting a friend declaration to be visible whenever there was a prior declaration. llvm-svn: 186331 --- clang/lib/Sema/SemaTemplate.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaTemplate.cpp') diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 6f1ab19f10e..e6006b6bf97 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1120,7 +1120,8 @@ Sema::CheckClassTemplate(Scope *S, unsigned TagSpec, TagUseKind TUK, NewClass->setAccess(PrevClassTemplate->getAccess()); } - NewTemplate->setObjectOfFriendDecl(); + NewTemplate->setObjectOfFriendDecl(/* PreviouslyDeclared = */ + PrevClassTemplate != NULL); // Friend templates are visible in fairly strange ways. if (!CurContext->isDependentContext()) { -- cgit v1.2.3