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

            Bug ID: 122030
           Summary: ICE when passing initializer list as NTTP
           Product: gcc
           Version: 15.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sudoksh99 at gmail dot com
  Target Milestone: ---

GCC ICE-ed on the following code

https://godbolt.org/z/xr3dd4s5e

```
#include <initializer_list>
template<auto...> void foo();
template<class> void bar() { foo<{}>(); }
template void bar<int>();
```

Error message:

```
during RTL pass: expand
<source>: In function 'void bar() [with <template-parameter-1-1> = int]':
<source>:3:37: internal compiler error: Segmentation fault
    3 | template<class> void bar() { foo<{}>(); }
      |                              ~~~~~~~^~
0x228dd45 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x229f296 internal_error(char const*, ...)
        ???:0
0x13561cb make_decl_rtl(tree_node*)
        ???:0
0xaefebc expand_call(tree_node*, rtx_def*, int)
        ???:0
0xc1758e expand_expr_real_1(tree_node*, rtx_def*, machine_mode,
expand_modifier, rtx_def**, bool)
        ???: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
```


Notes:
- Only happen on -std >= c++20
- Only happen when `bar` is a function template
- GCC (trunk) also ICE-ed

Reply via email to