function2 icon indicating copy to clipboard operation
function2 copied to clipboard

Incorrect Assignment Operator Overload for erasure<false, ...>::operator=

Open qq1174159858 opened this issue 6 months ago • 0 comments

In include/function2/function2.hpp, the following assignment operator overload appears to have an issue:

C++ template <typename OtherConfig> constexpr erasure& operator=(erasure<true, OtherConfig, property_t> right) noexcept { invoke_table_ = right.invoke_table_; view_ = right.view_; return *this; } Problem: This operator overload accepts an owning erasure (erasure<true, ...>) as the right-hand side, but assigns its internal pointer (view_ = right.view_) to the non-owning erasure (erasure<false, ...>).

qq1174159858 avatar Aug 23 '25 15:08 qq1174159858