summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-01-05 20:27:28 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-01-05 20:27:28 +0000
commit9c0c98604a728777ee30761c891f9971464b2809 (patch)
tree8069cb3a0be4fb5fe85cfccc100c89072bc7eb96 /clang/lib
parent1172332203b2074d8f2527ca07afcfb3f2678e27 (diff)
downloadbcm5719-llvm-9c0c98604a728777ee30761c891f9971464b2809.tar.gz
bcm5719-llvm-9c0c98604a728777ee30761c891f9971464b2809.zip
If an explicitly-specified pack might have been extended by template argument
deduction, don't forget to check the argument is valid. llvm-svn: 291170
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaTemplateDeduction.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/clang/lib/Sema/SemaTemplateDeduction.cpp b/clang/lib/Sema/SemaTemplateDeduction.cpp
index 6c90b5c2266..7750b9c0eae 100644
--- a/clang/lib/Sema/SemaTemplateDeduction.cpp
+++ b/clang/lib/Sema/SemaTemplateDeduction.cpp
@@ -2215,25 +2215,26 @@ static Sema::TemplateDeductionResult ConvertDeducedTemplateArguments(
if (!Deduced[I].isNull()) {
if (I < NumAlreadyConverted) {
- // We have already fully type-checked and converted this
- // argument, because it was explicitly-specified. Just record the
- // presence of this argument.
- Builder.push_back(Deduced[I]);
// We may have had explicitly-specified template arguments for a
// template parameter pack (that may or may not have been extended
// via additional deduced arguments).
- if (Param->isParameterPack() && CurrentInstantiationScope) {
- if (CurrentInstantiationScope->getPartiallySubstitutedPack() ==
- Param) {
- // Forget the partially-substituted pack; its substitution is now
- // complete.
- CurrentInstantiationScope->ResetPartiallySubstitutedPack();
- }
+ if (Param->isParameterPack() && CurrentInstantiationScope &&
+ CurrentInstantiationScope->getPartiallySubstitutedPack() == Param) {
+ // Forget the partially-substituted pack; its substitution is now
+ // complete.
+ CurrentInstantiationScope->ResetPartiallySubstitutedPack();
+ // We still need to check the argument in case it was extended by
+ // deduction.
+ } else {
+ // We have already fully type-checked and converted this
+ // argument, because it was explicitly-specified. Just record the
+ // presence of this argument.
+ Builder.push_back(Deduced[I]);
+ continue;
}
- continue;
}
- // We have deduced this argument, so it still needs to be
+ // We may have deduced this argument, so it still needs to be
// checked and converted.
if (ConvertDeducedTemplateArgument(S, Param, Deduced[I], Template, Info,
IsDeduced, Builder)) {
OpenPOWER on IntegriCloud