https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120337
Bug ID: 120337
Summary: internal compiler error: error reporting routines
re-entered. tuple library 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 <mutex>
#include <functional>
#include <iostream>
#include <chrono>
#include <thread>
class A {
private:
int b {0};
std::mutex m;
public:
void inc() {
b++;
}
};
int main()
{
A a;
std::thread t1(std::bind(&A::inc,std::ref(a)), a);
t1.join();
}
```
Stack dump
```
/opt/compiler-explorer/gcc-trunk-20250518/include/c++/16.0.0/tuple:992:2:
required by the constraints of 'template<class ... _Elements> template<class
... _UTypes> requires __disambiguating_constraint<_UTypes ...>() &&
__constructible<_UTypes ...>() && __dangles<_UTypes ...>() std::tuple<
<template-parameter-1-1> >::tuple(_UTypes&& ...)'
Segmentation fault
990 | && (__constructible<_UTypes...>())
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
internal compiler error: error reporting routines re-entered.
0x2944b3e diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
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
0xad8aaa fancy_abort(char const*, int, char const*)
???:0
0x294406b diagnostic_context::finish()
???:0
0x29443b7 diagnostic_context::action_after_output(diagnostic_t)
???:0
0x2944a27 diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
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
0xe6b211 pp_c_specifier_qualifier_list(c_pretty_printer*, tree_node*)
???:0
0xe6b1f0 pp_c_specifier_qualifier_list(c_pretty_printer*, tree_node*)
???:0
0xe6b445 c_pretty_printer::type_id(tree_node*)
???:0
0xb95770 cxx_pretty_printer::type_id(tree_node*)
???:0
0xe6b211 pp_c_specifier_qualifier_list(c_pretty_printer*, tree_node*)
???:0
0xb9579a cxx_pretty_printer::type_id(tree_node*)
???:0
0xb958b2 cxx_pretty_printer::type_id(tree_node*)
???:0
0xb9779e pp_cxx_parameter_mapping(cxx_pretty_printer*, tree_node*)
???:0
0xbf588b expr_to_string(tree_node*)
???:0
0x2986373 pretty_printer::format(text_info&)
???:0
0x2944796 diagnostic_context::report_diagnostic(diagnostic_info*)
???:0
```
To quickly reproduce:
https://godbolt.org/z/vzEWKfY1b