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

            Bug ID: 96060
           Summary: ICE with spaceship default operator returning int
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nunoplopes at sapo dot pt
  Target Milestone: ---

```
#include <set>

struct xx {
    int a;
    int operator<=>(const xx&) const = default;
};

int f(std::set<xx> &x) {
    x.emplace(0);
    return 0;
}
```

<source>: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const
_Tp&, const _Tp&) const [with _Tp = xx]':

/opt/compiler-explorer/gcc-trunk-20200703/include/c++/11.0.0/bits/stl_tree.h:2101:35:
  required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*>
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = xx; _Val = xx;
_KeyOfValue = std::_Identity<xx>; _Compare = std::less<xx>; _Alloc =
std::allocator<xx>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::key_type = xx]'

/opt/compiler-explorer/gcc-trunk-20200703/include/c++/11.0.0/bits/stl_tree.h:2419:19:
  required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool>
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::_M_emplace_unique(_Args&& ...) [with _Args = {int}; _Key = xx; _Val =
xx; _KeyOfValue = std::_Identity<xx>; _Compare = std::less<xx>; _Alloc =
std::allocator<xx>]'

/opt/compiler-explorer/gcc-trunk-20200703/include/c++/11.0.0/bits/stl_set.h:463:33:
  required from 'std::pair<typename std::_Rb_tree<_Key, _Key,
std::_Identity<_Tp>, _Compare, typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator, bool>
std::set<_Key, _Compare, _Alloc>::emplace(_Args&& ...) [with _Args = {int};
_Key = xx; _Compare = std::less<xx>; _Alloc = std::allocator<xx>; typename
std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator =
std::_Rb_tree<xx, xx, std::_Identity<xx>, std::less<xx>, std::allocator<xx>
>::const_iterator; typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other = std::allocator<xx>;
typename __gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> =
__gnu_cxx::__alloc_traits<std::allocator<xx>, xx>::rebind<xx>; typename
_Alloc::value_type = xx]'

<source>:9:16:   required from here

<source>:5:9: internal compiler error: in genericize_spaceship, at
cp/method.c:1050

    5 |     int operator<=>(const xx&) const = default;

      |         ^~~~~~~~

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

Compiler returned: 1


https://gcc.godbolt.org/z/ZFjHyd

Reply via email to