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

            Bug ID: 115773
           Summary: gcc crashed with a init-capture which introduces a
                    pack inside another lambda
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rungecc at gmail dot com
  Target Milestone: ---

```c++
// g++ -std=c++26 main.cpp
constexpr auto gcc_ice(auto&& func) noexcept {
    return []<class... Ts>(Ts&&...) noexcept { return ((void)[... args1=Ts{}]
{}, false); };
}

int main() { (void)(gcc_ice(1)()); }

```


See online compiler: https://godbolt.org/z/q9hac3nhY

Stacktrace:

```
<source>: In instantiation of 'constexpr auto gcc_ice(auto:1&&) [with auto:1 =
int]':
<source>:5:28:   required from here
    5 | int main() { (void)(gcc_ice(1)()); }
      |                     ~~~~~~~^~~
<source>:2:76: internal compiler error: Segmentation fault
    2 |     return []<class... Ts>(Ts&&...) noexcept { return ((void)[...
args1=Ts{}] {}, false); };
      |                                                                        
   ^
0x26de735 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1],
diagnostic_t)
        ???:0
0x26ec2e2 internal_error(char const*, ...)
        ???:0
0xcb7369 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcc4757 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcb7fbb tsubst_tree_list(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xcc50cd tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xca7b03 instantiate_decl(tree_node*, bool, bool)
        ???:0
0xb65035 maybe_instantiate_decl(tree_node*)
        ???:0
0xb66c86 mark_used(tree_node*, int)
        ???:0
0xa94d3e build_new_function_call(tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ???:0
0xcede1e finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool,
bool, int)
        ???:0
0xc702da c_parse_file()
        ???:0
0xdc6e39 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://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

Reply via email to