[clang] a8d096a - [Concepts] Add missing null check to transformConstructor
Saar Raz via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 26 14:15:55 PST 2020
Author: Saar Raz
Date: 2020-01-27T00:15:42+02:00
New Revision: a8d096aff6b1930ad57bd0c30077d2b4920b5025
URL: https://github.com/llvm/llvm-project/commit/a8d096aff6b1930ad57bd0c30077d2b4920b5025
DIFF: https://github.com/llvm/llvm-project/commit/a8d096aff6b1930ad57bd0c30077d2b4920b5025.diff
LOG: [Concepts] Add missing null check to transformConstructor
Caused bug 44671 when transforming a constructor with a type-constraint with no explicit template args.
Added:
Modified:
clang/lib/Sema/SemaTemplate.cpp
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index ba4cd7632f3c..4d38d07a6213 100755
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -2047,12 +2047,14 @@ struct ConvertConstructorToDeductionGuideTransform {
if (const auto *TC = TTP->getTypeConstraint()) {
TemplateArgumentListInfo TransformedArgs;
const auto *ArgsAsWritten = TC->getTemplateArgsAsWritten();
- if (SemaRef.Subst(ArgsAsWritten->getTemplateArgs(),
+ if (!ArgsAsWritten ||
+ SemaRef.Subst(ArgsAsWritten->getTemplateArgs(),
ArgsAsWritten->NumTemplateArgs, TransformedArgs,
Args))
SemaRef.AttachTypeConstraint(
TC->getNestedNameSpecifierLoc(), TC->getConceptNameInfo(),
- TC->getNamedConcept(), &TransformedArgs, NewTTP,
+ TC->getNamedConcept(), ArgsAsWritten ? &TransformedArgs : nullptr,
+ NewTTP,
NewTTP->isParameterPack()
? cast<CXXFoldExpr>(TC->getImmediatelyDeclaredConstraint())
->getEllipsisLoc()
More information about the cfe-commits
mailing list