https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120275
Bug ID: 120275
Summary: ICE in write_type at cp/mangle.cc:2687 when using
decltype(auto) with initializer list since 11.3
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mario.rodriguezb1 at um dot es
Target Milestone: ---
ICE with decltype(auto) in write_type at cp/mangle.cc:2687. It might b related
with issue https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120129, as it happens
since 11.3 also, but stack is totally different and internal error arises in a
different location:
```
#include <iostream>
int main()
{
decltype(auto) values = {1, 2, 3, 4};
values.size()
}
```
```
opt/compiler-explorer/gcc-trunk-20250514/include/c++/16.0.0/initializer_list:71:7:
internal compiler error: in write_type, at cp/mangle.cc:2687
71 | size() const noexcept { return _M_len; }
| ^~~~
0x293fa35 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x295d7a6 internal_error(char const*, ...)
???:0
0xada636 fancy_abort(char const*, int, char const*)
???:0
0xc28879 mangle_decl(tree_node*)
???:0
0x17df8e5 decl_assembler_name(tree_node*)
???:0
0xf38d41 symbol_table::finalize_compilation_unit()
???:0
```
In previous versions (from 11.3 until 14.2), ICE was hidden by
"/opt/compiler-explorer/gcc-11.3.0/include/c++/11.3.0/initializer_list:71:
confused by earlier errors, bailing out", in trunk it gives the stack:
https://godbolt.org/z/5jzTsE9r1