[llvm] [ADT] Make SmallVector satisfy is_nothrow_move_constructible (PR #147684)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 03:11:02 PDT 2025


https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/147684

None

>From 48b778341b6f1ef3dcc6706742058cf39c65e2e9 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 12 Jun 2025 17:56:48 +0100
Subject: [PATCH] [ADT] Make SmallVector satisfy is_nothrow_move_constructible

---
 llvm/include/llvm/ADT/SmallVector.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
index 0b8bb48b8fe5e..1a422f40db317 100644
--- a/llvm/include/llvm/ADT/SmallVector.h
+++ b/llvm/include/llvm/ADT/SmallVector.h
@@ -1234,7 +1234,7 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
     this->append(A.begin(), A.end());
   }
 
-  SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(N) {
+  SmallVector(const SmallVector &RHS) noexcept : SmallVectorImpl<T>(N) {
     if (!RHS.empty())
       SmallVectorImpl<T>::operator=(RHS);
   }
@@ -1244,7 +1244,7 @@ class LLVM_GSL_OWNER SmallVector : public SmallVectorImpl<T>,
     return *this;
   }
 
-  SmallVector(SmallVector &&RHS) : SmallVectorImpl<T>(N) {
+  SmallVector(SmallVector &&RHS) noexcept : SmallVectorImpl<T>(N) {
     if (!RHS.empty())
       SmallVectorImpl<T>::operator=(::std::move(RHS));
   }



More information about the llvm-commits mailing list