[clang] [Clang] Fix a use-after-move issue in SubsumptionChecker (PR #164781)
Younan Zhang via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 23 02:16:20 PDT 2025
https://github.com/zyn0217 created https://github.com/llvm/llvm-project/pull/164781
Spotted by Shafik in https://github.com/llvm/llvm-project/pull/161671#discussion_r2453641287
>From ccb96a36e12f263ce3142ca9bdd1c5ea201e683e Mon Sep 17 00:00:00 2001
From: Younan Zhang <zyn7109 at gmail.com>
Date: Thu, 23 Oct 2025 17:13:37 +0800
Subject: [PATCH] [Clang] Fix a use-after-move issue in SubsumptionChecker
Spotted by Shafik
---
clang/lib/Sema/SemaConcept.cpp | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaConcept.cpp b/clang/lib/Sema/SemaConcept.cpp
index f77fca2a69e00..70149464b3a99 100644
--- a/clang/lib/Sema/SemaConcept.cpp
+++ b/clang/lib/Sema/SemaConcept.cpp
@@ -2669,8 +2669,9 @@ FormulaType SubsumptionChecker::Normalize(const NormalizedConstraint &NC) {
});
if (Compound.getCompoundKind() == FormulaType::Kind) {
+ unsigned SizeLeft = Left.size();
Res = std::move(Left);
- Res.reserve(Left.size() + Right.size());
+ Res.reserve(SizeLeft + Right.size());
std::for_each(std::make_move_iterator(Right.begin()),
std::make_move_iterator(Right.end()), Add);
return Res;
More information about the cfe-commits
mailing list