https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120339
Bug ID: 120339
Summary: internal compiler error: Segmentation fault
diagnostic_impl since version 14.1
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 in:
```
#include <iostream>
int main() {
std::ostream& out = std::cerr;
auto print = [](auto&... args) {
out << std::endl;
}
}
```
Stack dump
```
<source>:5:25: internal compiler error: Segmentation fault
5 | out << std::endl;
| ^~~~
0x2944c55 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
???:0
0x29629c6 internal_error(char const*, ...)
???:0
0xb12f06 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
???:0
0xdbd982 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
???:0
0xcfcc93 c_parse_file()
???:0
0xe618c9 c_common_parse_file()
???:0
```
To quickly reproduce:
https://godbolt.org/z/zKx14ne49