Skip to content

Commit d283646

Browse files
committed
fix leak
1 parent 701ba1f commit d283646

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

clang/include/clang/Sema/Sema.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13174,9 +13174,9 @@ class Sema final : public SemaBase {
1317413174
: Kind(TemplateInstantiation),
1317513175
SavedInNonInstantiationSFINAEContext(false),
1317613176
InConstraintSubstitution(false),
13177-
InParameterMappingSubstitution(false),
13178-
Entity(nullptr), Template(nullptr),
13179-
TemplateArgs(nullptr), NumTemplateArgs(0), DeductionInfo(nullptr) {}
13177+
InParameterMappingSubstitution(false), Entity(nullptr),
13178+
Template(nullptr), TemplateArgs(nullptr), NumTemplateArgs(0),
13179+
DeductionInfo(nullptr) {}
1318013180

1318113181
/// Determines whether this template is an actual instantiation
1318213182
/// that should be counted toward the maximum instantiation depth.

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ clang::MakeDeductionFailureInfo(ASTContext &Context,
804804
case TemplateDeductionResult::ConstraintsNotSatisfied: {
805805
CNSInfo *Saved = new (Context) CNSInfo;
806806
Saved->TemplateArgs = Info.takeSugared();
807-
Saved->Satisfaction = Info.AssociatedConstraintsSatisfaction;
807+
Saved->Satisfaction = std::move(Info.AssociatedConstraintsSatisfaction);
808808
Result.Data = Saved;
809809
break;
810810
}
@@ -852,6 +852,7 @@ void DeductionFailureInfo::Destroy() {
852852

853853
case TemplateDeductionResult::ConstraintsNotSatisfied:
854854
// FIXME: Destroy the template argument list?
855+
static_cast<CNSInfo *>(Data)->Satisfaction.~ConstraintSatisfaction();
855856
Data = nullptr;
856857
if (PartialDiagnosticAt *Diag = getSFINAEDiagnostic()) {
857858
Diag->~PartialDiagnosticAt();

0 commit comments

Comments
 (0)