diff options
| author | John McCall <rjmccall@apple.com> | 2010-10-14 22:22:28 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-10-14 22:22:28 +0000 |
| commit | f4776590402a62ff1517aa07f2d1e7284b80a5bc (patch) | |
| tree | 230af3d52c60da19974591adab08524b59d6e242 /clang/lib/Sema | |
| parent | 57756eabc9a12450404f649daac86a620230e05d (diff) | |
| download | bcm5719-llvm-f4776590402a62ff1517aa07f2d1e7284b80a5bc.tar.gz bcm5719-llvm-f4776590402a62ff1517aa07f2d1e7284b80a5bc.zip | |
template-ids are looked up differently in friend declarations.
llvm-svn: 116529
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaDeclCXX.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp index a63f057ae0a..ee0b172ee61 100644 --- a/clang/lib/Sema/SemaDeclCXX.cpp +++ b/clang/lib/Sema/SemaDeclCXX.cpp @@ -6384,6 +6384,7 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition, // declaration, if there is no prior declaration, the program is // ill-formed. bool isLocal = cast<CXXRecordDecl>(CurContext)->isLocalClass(); + bool isTemplateId = D.getName().getKind() == UnqualifiedId::IK_TemplateId; // Find the appropriate context according to the above. DC = CurContext; @@ -6404,7 +6405,11 @@ Decl *Sema::ActOnFriendFunctionDecl(Scope *S, Declarator &D, bool IsDefinition, if (isLocal || !Previous.empty()) break; - if (DC->isFileContext()) break; + if (isTemplateId) { + if (isa<TranslationUnitDecl>(DC)) break; + } else { + if (DC->isFileContext()) break; + } DC = DC->getParent(); } |

