aco: guard small_vector move/copy operator against self assignment
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33043>
This commit is contained in:
@@ -1080,6 +1080,8 @@ public:
|
||||
|
||||
constexpr small_vec& operator=(const small_vec& other)
|
||||
{
|
||||
if (&other == this)
|
||||
return *this;
|
||||
clear();
|
||||
reserve(other.capacity);
|
||||
length = other.length;
|
||||
@@ -1089,6 +1091,8 @@ public:
|
||||
|
||||
constexpr small_vec& operator=(small_vec&& other) noexcept
|
||||
{
|
||||
if (&other == this)
|
||||
return *this;
|
||||
clear();
|
||||
void* ptr = this;
|
||||
memcpy(ptr, &other, sizeof(*this));
|
||||
|
||||
Reference in New Issue
Block a user