Add support for out-of-line definitions of conversion function

templates. Previously, a little thinko in the code that replaced a
conversion function template with its redeclaration was causing some
very weird lookup behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@93166 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2010-01-11 18:53:25 +00:00
Родитель 58408bc4ea
Коммит 0c55106cf9
1 изменённых файлов: 7 добавлений и 4 удалений

Просмотреть файл

@ -2746,11 +2746,14 @@ Sema::DeclPtrTy Sema::ActOnConversionDeclarator(CXXConversionDecl *Conversion) {
if (Conversion->getPrimaryTemplate()) {
// ignore specializations
} else if (Conversion->getPreviousDeclaration()) {
const NamedDecl *ExpectedPrevDecl = Conversion->getPreviousDeclaration();
if (FunctionTemplateDecl *ConversionTemplate
= Conversion->getDescribedFunctionTemplate())
ExpectedPrevDecl = ConversionTemplate->getPreviousDeclaration();
if (ClassDecl->replaceConversion(ExpectedPrevDecl, Conversion))
= Conversion->getDescribedFunctionTemplate()) {
if (ClassDecl->replaceConversion(
ConversionTemplate->getPreviousDeclaration(),
ConversionTemplate))
return DeclPtrTy::make(ConversionTemplate);
} else if (ClassDecl->replaceConversion(Conversion->getPreviousDeclaration(),
Conversion))
return DeclPtrTy::make(Conversion);
assert(Conversion->isInvalidDecl() && "Conversion should not get here.");
} else if (FunctionTemplateDecl *ConversionTemplate