From: Gabor Greif Date: Sat, 28 Aug 2010 00:16:06 +0000 (+0000) Subject: fix PR8007 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=40181c4e587b8a988e691d7b46580b1a1212c535;p=clang fix PR8007 reordering and redefinition issues still may linger, I plan to nail them next git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112333 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp index 21c7e44544..c699623882 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -7709,7 +7709,12 @@ void Sema::MarkDeclarationReferenced(SourceLocation Loc, Decl *D) { else PendingInstantiations.push_back(std::make_pair(Function, Loc)); } - } + } else // Walk redefinitions, as some of them may be instantiable. + for (FunctionDecl::redecl_iterator i(Function->redecls_begin()), + e(Function->redecls_end()); i != e; ++i) { + if (i->isImplicitlyInstantiable()) + MarkDeclarationReferenced(Loc, *i); + } // FIXME: keep track of references to static functions diff --git a/test/SemaTemplate/inject-templated-friend.cpp b/test/SemaTemplate/inject-templated-friend.cpp index 67da8342f2..56feae5d26 100644 --- a/test/SemaTemplate/inject-templated-friend.cpp +++ b/test/SemaTemplate/inject-templated-friend.cpp @@ -1,5 +1,4 @@ // RUN: %clang %s -S -emit-llvm -o - | grep -e "define linkonce_odr.*_ZN6pr8007lsERNS_11std_ostreamERKNS_8StreamerINS_3FooEEE" -// XFAIL: * namespace pr8007 {