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 <[email protected]> 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; _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
