-
-
Notifications
You must be signed in to change notification settings - Fork 262
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
First of all, I want to thank you for making CppInsights, it is a great and handy tool.
Then, consider the following C++20 code:
#include <utility>
namespace tnt
{
// vector
template <typename T, std::size_t N>
struct vector final
{
static_assert(N > 0);
template <typename U, std::size_t S>
constexpr vector& operator=(vector<U, S> &&rhs) noexcept
{
if (this != &rhs)
[this, rhs = std::move(rhs)]
<std::size_t... I>(std::index_sequence<I...>) noexcept {
((data[I] = std::exchange(rhs.data[I], U(0))), ...);
}(std::make_index_sequence<S>{});
return *this;
}
private:
T data[N]{};
};
} // namespace tnt
int main()
{
}As it can be seen from the generated code of the move assignment operator, the lambda is generated inside the if clause, and then called outside the if. The part from the generated lambda-class body and after the invocation of the lambda should be inside the if (surrounded by { and }).
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working