https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108317
Bug ID: 108317 Summary: g++ is unable to capture vector-extended variables Product: gcc Version: 12.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: janezz55 at gmail dot com Target Milestone: --- Created attachment 54204 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54204&action=edit sample file demonstrating the bug g++ will be unable to capture v_ in the code sample below, but clang++ will do so just fine. template <std::size_t M> auto operator+(pint<T, M> const& o) const noexcept { pint r; [&]<auto ...I>(std::index_sequence<I...>) noexcept { bool c; ( [&]() noexcept { if constexpr(I) { r.v_[I] = c + v_[I] + (I < M ? o.v_[I] : T{}); c = c ? r.v_[I] <= v_[I] : r.v_[I] < v_[I]; } else { c = (r.v_[I] = v_[I] + o.v_[I]) < v_[I]; } }(), ... ); }(std::make_index_sequence<N>()); return r; } error: 'v_' was not declared in this scope