Skip to content

Build problem with upcoming gcc-16 #29

@hhoffstaette

Description

@hhoffstaette

Originally reported in Gentoo: https://bugs.gentoo.org/964308

Probably since commit https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=876d1a22dfaf873d167bd2ffad190a1d07a81b22 there seems to be something wrong with the comparator function.

test_tree.cc:292:11:   
  292 |                 tr3.sort(tr3.begin(bdy), tr3.end(bdy), comp, true); // false: no sorting of subtrees
      |                 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_tree.h:1402:72: error: static assertion failed: comparison object must be invocable with two arguments of key type
 1402 |             __is_invocable<const _Compare&, const _Key&, const _Key&>::value,
      |                                                                        ^~~~~
  • ‘std::integral_constant<bool, false>::value’ evaluates to false
/usr/lib/gcc/x86_64-pc-linux-gnu/16/include/g++-v16/bits/stl_tree.h:1406:40: error: no match for call to ‘(const tree<std::__cxx11::basic_string<char> >::compare_nodes<std::less<std::__cxx11::basic_string<char> > >) (tree_node_<std::__cxx11::basic_string<char> >* const&, tree_node_<std::__cxx11::basic_string<char> >* const&)’
 1406 |           return _M_impl._M_key_compare(__k1, __k2);
      |                  ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
  • there is 1 candidate
    tree.hh:504:23:
      504 |                 class compare_nodes {
          |                       ^~~~~~~~~~~~~
    • candidate 1: ‘bool tree<T, tree_node_allocator>::compare_nodes<StrictWeakOrdering>::operator()(const tree<T, tree_node_allocator>::tree_node*, const tree<T, tree_node_allocator>::tree_node*) [with StrictWeakOrdering = std::less<std::__cxx11::basic_string<char> >; T = std::__cxx11::basic_string<char>; tree_node_allocator = std::allocator<tree_node_<std::__cxx11::basic_string<char> > >; tree<T, tree_node_allocator>::tree_node = tree_node_<std::__cxx11::basic_string<char> >]’ (near match)
      tree.hh:508:38:
        508 |                                 bool operator()(const tree_node *a, const tree_node *b)
            |                                      ^~~~~~~~
      • passing ‘const tree<std::__cxx11::basic_string<char> >::compare_nodes<std::less<std::__cxx11::basic_string<char> > >*’ as ‘this’ argument discards qualifiers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions