diff options
author | Chandler Carruth <chandlerc@gmail.com> | 2011-08-18 09:09:59 +0000 |
---|---|---|
committer | Chandler Carruth <chandlerc@gmail.com> | 2011-08-18 09:09:59 +0000 |
commit | 48b2831d8ade9f30bf6e82f584e840d7dc9d7ec7 (patch) | |
tree | 4da7db76edb4b235f5568067383cb650bf26d9a9 /clang/lib | |
parent | 2f2e9c5057619b6ba90568bc2533f10f931a2b7e (diff) | |
download | bcm5719-llvm-48b2831d8ade9f30bf6e82f584e840d7dc9d7ec7.tar.gz bcm5719-llvm-48b2831d8ade9f30bf6e82f584e840d7dc9d7ec7.zip |
Always mark friend function declarations in class templates as
implicitly instantiable, even if we don't see a body on the friend
function declaration. The body may simply have not yet been attached.
This fixes PR10666.
There may be an alternate, preferred implementation strategy, see my
FIXME. Review would definitely be appreciated Doug. =D
llvm-svn: 137934
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaTemplateInstantiateDecl.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp index 812482e4361..a1ae00cb1cd 100644 --- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp +++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp @@ -1153,9 +1153,13 @@ Decl *TemplateDeclInstantiator::VisitFunctionDecl(FunctionDecl *D, Innermost.first, Innermost.second), InsertPos); - } else if (isFriend && D->isThisDeclarationADefinition()) { - // TODO: should we remember this connection regardless of whether - // the friend declaration provided a body? + } else if (isFriend) { + // Note, we need this connection even if the friend doesn't have a body. + // Its body may exist but not have been attached yet due to deferred + // parsing. + // FIXME: It might be cleaner to set this when attaching the body to the + // friend function declaration, however that would require finding all the + // instantiations and modifying them. Function->setInstantiationOfMemberFunction(D, TSK_ImplicitInstantiation); } |