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

            Bug ID: 124154
           Summary: [this auto] ICE when handling lambda with `this auto`.
           Product: gcc
           Version: 15.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shyeyian at petalmail dot com
  Target Milestone: ---

hello.cpp:
=====
struct S
{
    int x;
    void f()
    {
        auto l = [&] (this auto) { (void)x; };
    }
};
=====

command:
=====
[shyeyian@matebook test]$ g++ -std=c++23 hello.cpp
hello.cpp: In instantiation of 'S::f()::<lambda(this auto:1)> [with auto:1 =
S::f()::<lambda(this auto:1)>]':
hello.cpp:7:10:   required from here
    7 |         l();
      |         ~^~
hello.cpp:6:42: internal compiler error: Segmentation fault
    6 |         auto l = [&] (this auto) { (void)x; };
      |                                          ^
0x26ef811 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x2749918 internal_error(char const*, ...)
        ???:0
0x9423b5 perform_or_defer_access_check(tree_node*, tree_node*, tree_node*, int,
access_failure_info*)
        ???:0
0x943feb finish_non_static_data_member(tree_node*, tree_node*, tree_node*, int)
        ???:0
0x923a2a tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x928f4d instantiate_decl(tree_node*, bool, bool)
        ???:0
0x7b78d2 maybe_instantiate_decl(tree_node*)
        ???:0
0x7c9317 mark_used(tree_node*, int)
        ???:0
0x754c99 build_op_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, int)
        ???:0
0x946bb6 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xa238f0 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues>
for instructions.
[shyeyian@matebook test]$ g++ -std=c++23 hello.cpp
/usr/bin/ld: /usr/lib/gcc/x86_64-pc-linux-gnu/15.2.1/../../../../lib/Scrt1.o:
in function `_start':
(.text+0x1b): undefined reference to `main'
collect2: error: ld returned 1 exit status
[shyeyian@matebook test]$
=====

g++ version: 15.2
system: linux

Reply via email to