diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-02 00:02:34 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-02 00:02:34 +0000 |
commit | 053105d58552c600a2e56473592212a9bddafcd4 (patch) | |
tree | 1f35d1b83dab862f35d03c1727152ccdbde6a3f7 /lib | |
parent | 73a48ad77c04987730a2469ef334a752dff94894 (diff) |
When performing template argument deduction against a template-id,
only keep deduction results for successful deductions, so that they
can be compared against each other. Fixes PR8462, from Richard Smith!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117983 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaTemplateDeduction.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp index 855516cf10..905e17e9c1 100644 --- a/lib/Sema/SemaTemplateDeduction.cpp +++ b/lib/Sema/SemaTemplateDeduction.cpp @@ -721,6 +721,8 @@ DeduceTemplateArguments(Sema &S, llvm::SmallVector<const RecordType *, 8> ToVisit; ToVisit.push_back(RecordT); bool Successful = false; + llvm::SmallVectorImpl<DeducedTemplateArgument> DeducedOrig(0); + DeducedOrig = Deduced; while (!ToVisit.empty()) { // Retrieve the next class in the inheritance hierarchy. const RecordType *NextT = ToVisit.back(); @@ -738,9 +740,14 @@ DeduceTemplateArguments(Sema &S, QualType(NextT, 0), Info, Deduced); // If template argument deduction for this base was successful, - // note that we had some success. - if (BaseResult == Sema::TDK_Success) + // note that we had some success. Otherwise, ignore any deductions + // from this base class. + if (BaseResult == Sema::TDK_Success) { Successful = true; + DeducedOrig = Deduced; + } + else + Deduced = DeducedOrig; } // Visit base classes |