public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/108317] New: g++ is unable to capture vector-extended variables
@ 2023-01-06 14:11 janezz55 at gmail dot com
  2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: janezz55 at gmail dot com @ 2023-01-06 14:11 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-01-06 18:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-06 14:11 [Bug c++/108317] New: g++ is unable to capture vector-extended variables janezz55 at gmail dot com
2023-01-06 14:11 ` [Bug c++/108317] " janezz55 at gmail dot com
2023-01-06 18:04 ` [Bug c++/108317] dependent vector field is not causing this to be captured for fold expression inside a if constexpr block pinskia at gcc dot gnu.org
2023-01-06 18:07 ` [Bug c++/108317] dependent vector field is not causing field of this not to be found " pinskia at gcc dot gnu.org
2023-01-06 18:10 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).