diff options
| author | John McCall <rjmccall@apple.com> | 2009-09-02 00:55:30 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2009-09-02 00:55:30 +0000 |
| commit | d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a (patch) | |
| tree | e289f4fe185b5239b61f2fc9e4224349815fe510 /lib/Sema/SemaDecl.cpp | |
| parent | 883f127b28fe6ecffcdf5f86b087fd2c20dbecb8 (diff) | |
| download | clang-d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a.tar.gz clang-d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a.tar.bz2 clang-d7eff68dbbbc6b3f8dfd44f6a833c2b320a96e9a.tar.xz | |
Ensure that the tag decls of friend decls aren't added to the friending class's
decl list, and remove some workarounds that were due to this. Thanks to Eli for
pointing this out and providing the test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80745 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
| -rw-r--r-- | lib/Sema/SemaDecl.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp index 8eb2c717b4..86222ffe14 100644 --- a/lib/Sema/SemaDecl.cpp +++ b/lib/Sema/SemaDecl.cpp @@ -4328,7 +4328,15 @@ CreateNewDecl: New->startDefinition(); // If this has an identifier, add it to the scope stack. - if (Name && TUK != TUK_Friend) { + if (TUK == TUK_Friend) { + // Friend tag decls are visible in fairly strange ways. + if (!CurContext->isDependentContext()) { + DeclContext *DC = New->getDeclContext()->getLookupContext(); + DC->makeDeclVisibleInContext(New, /* Recoverable = */ false); + if (Scope *EnclosingScope = getScopeForDeclContext(S, DC)) + PushOnScopeChains(New, EnclosingScope, /* AddToContext = */ false); + } + } else if (Name) { S = getNonFieldDeclScope(S); PushOnScopeChains(New, S); } else { |
