https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122632
Bug ID: 122632
Summary: ICE when issuing a diagnostics message (C++26)
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tymi at tymi dot org
Target Milestone: ---
```cpp
#include <utility>
#include <functional>
#include <string_view>
#include <print>
template <auto Func, typename... Params>
[[nodiscard]] constexpr auto bind_front(Params&&... params) noexcept {
return [...params = std::forward<Params>(params)]
<typename... Inner>(Inner&&... inner) noexcept(
noexcept(std::invoke(Func, params...,
std::forward<Inner>(inner)...))
) {
return std::invoke(Func, params...,
std::forward<Inner>(inner)...);
};
}
void print(const std::string_view prefix, const std::string_view suffix)
{
std::println("{} {}", prefix, suffix);
}
int main()
{
const auto hi = bind_front<print>("Hello");
hi("world!");
}
```
```
<source>: In instantiation of 'constexpr auto bind_front(Params&& ...) [with
auto Func = print; Params = {const char (&)[6]}]':
required from here
<source>:23:38:
23 | const auto hi = bind_front<print>("Hello");
| ~~~~~~~~~~~~~~~~~^~~~~~~~~
<source>:10:36: internal compiler error: Segmentation fault
10 | noexcept(std::invoke(Func, params...,
std::forward<Inner>(inner)...))
|
~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
0x2906548 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
???:0
0x28fb33b internal_error(char const*, ...)
???:0
0xd84d03 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*)
???:0
0xd7d15a tsubst(tree_node*, tree_node*, int, tree_node*)
???:0
0xd6f660 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
???:0
0xda708d instantiate_decl(tree_
```