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

            Bug ID: 120532
           Summary: diagnostic_context::diagnostic_impl ICE in refwrap.h
           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: ---

Maybe related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120339.

## Program

```
#include <iostream>
#include <vector>

using my_func = void(int) &&;

int main()
{
    std::vector<std::reference_wrapper<my_func>> vec;
}
```

## Stack dump

```
/opt/compiler-explorer/gcc-trunk-20250604/include/c++/16.0.0/bits/refwrap.h:335:53:
internal compiler error: Segmentation fault
  335 |                 =
decltype(reference_wrapper::_S_fun(std::declval<_Up>()))>
      |                           
~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
0x282a0a5 diagnostic_context::diagnostic_impl(rich_location*,
diagnostic_metadata const*, diagnostic_option_id, char const*, __va_list_tag
(*) [1], diagnostic_t)
        ???:0
0x284b7e6 internal_error(char const*, ...)
        ???:0
0xd383cd tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd38954 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0xd66c3c instantiate_class_template(tree_node*)
        ???:0
0xdc3644 complete_type_or_maybe_complain(tree_node*, tree_node*, int)
        ???:0
0xdd6a2a cp_build_binary_op(op_location_t const&, tree_code, tree_node*,
tree_node*, int)
        ???:0
0xb17eb4 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node*, tree_node**, int)
        ???:0
0xdc60d2 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node*, tree_node**, int)
        ???:0
0xd5ae6d instantiate_decl(tree_node*, bool, bool)
        ???:0
0xd6a482 instantiate_pending_templates(int)
        ???:0
0xbeabf1 c_parse_final_cleanups()
        ???:0
0xe6ab08 c_common_parse_file()
        ???:0
```

To quickly reproduce:

https://godbolt.org/z/6envcsc66

Reply via email to