]> granicus.if.org Git - clang/commitdiff
Preserve the original scope when picking the right scope for a friend
authorJohn McCall <rjmccall@apple.com>
Wed, 13 Oct 2010 06:22:15 +0000 (06:22 +0000)
committerJohn McCall <rjmccall@apple.com>
Wed, 13 Oct 2010 06:22:15 +0000 (06:22 +0000)
declaration, because we'll need it later.  Hopefully fixed self-host.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@116399 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclCXX.cpp

index 62ac3bb455c18e14406cdf3fb761299e98771c02..55f668b5c51ad3298d0708ffeb727f7078dff29f 100644 (file)
@@ -6337,6 +6337,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
   // The context we found the declaration in, or in which we should
   // create the declaration.
   DeclContext *DC;
+  Scope *DCScope = S;
   LookupResult Previous(*this, NameInfo, LookupOrdinaryName,
                         ForRedeclaration);
 
@@ -6395,7 +6396,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
         && !getLangOptions().CPlusPlus0x)
       Diag(DS.getFriendSpecLoc(), diag::err_friend_is_member);
 
-    S = getScopeForDeclContext(S, DC);
+    DCScope = getScopeForDeclContext(S, DC);
 
   //   - There's a non-dependent scope specifier, in which case we
   //     compute it and do a previous lookup there for a function
@@ -6454,7 +6455,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition,
   }
 
   bool Redeclaration = false;
-  NamedDecl *ND = ActOnFunctionDeclarator(S, D, DC, T, TInfo, Previous,
+  NamedDecl *ND = ActOnFunctionDeclarator(DCScope, D, DC, T, TInfo, Previous,
                                           move(TemplateParams),
                                           IsDefinition,
                                           Redeclaration);