public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106086] New: ICE: trying to capture 'this' in instantiation of generic lambda
@ 2022-06-26  5:37 ldalessandro at gmail dot com
  2022-07-14 14:20 ` [Bug c++/106086] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ldalessandro at gmail dot com @ 2022-06-26  5:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106086

            Bug ID: 106086
           Summary: ICE: trying to capture 'this' in instantiation of
                    generic lambda
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

Following code generates ICE

    #include <array>
    #include <concepts>
    #include <utility>

    template <int>
    struct foo {
        constexpr auto operator()(std::same_as<int> auto...) const -> int {
            return 0;
        }
    };

    template <int _size>
    struct bar : foo<_size>
    {
        constexpr auto operator()(std::array<int, _size> index) const -> int
        {
            return [&]<std::size_t... i>(std::index_sequence<i...>) {
                return foo<_size>::operator()(index[i]...);
            }(std::make_index_sequence<_size>());
        }
    };

    bar<1> b;
    int i = b({0}); // <-- ERROR

<source>:18:58: internal compiler error: trying to capture 'this' in
instantiation of generic lambda

live: https://godbolt.org/z/TKGWME5aG

A couple of similar, closed bugs show up in the search so I've added them as
see-also. 105788 might be the same but it's listed as "ice-on-invalid-code" and
I'm fairly sure mine is valid (it refers to 100291).

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

end of thread, other threads:[~2023-10-25 20:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-26  5:37 [Bug c++/106086] New: ICE: trying to capture 'this' in instantiation of generic lambda ldalessandro at gmail dot com
2022-07-14 14:20 ` [Bug c++/106086] " ppalka at gcc dot gnu.org
2023-10-20 14:50 ` cvs-commit at gcc dot gnu.org
2023-10-20 14:51 ` ppalka at gcc dot gnu.org
2023-10-25 20:21 ` ppalka 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).