public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
@ 2021-04-23  7:27 marxin at gcc dot gnu.org
  2021-04-23  7:28 ` [Bug libstdc++/100226] " marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-23  7:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100226
           Summary: [11/12 Regression] c++/11/bits/stl_tree.h:770:8:
                    error: static assertion failed: comparison object must
                    be invocable as const
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
  Target Milestone: ---

It's taken from ncurses package, where the package can be built with GCC 10.
It's likely caused
by changes in libstdc++ in header files. I can build g++-10 -E && g++-11
ncurses.ii, but g++-11 ... fails.
It's also very difficult to decode the error message.

$ g++ ncurses.ii -c
In file included from /usr/include/c++/11/set:60,
                 from /usr/include/zypp/Arch.h:17,
                 from /usr/include/zypp/sat/Solvable.h:22,
                 from /usr/include/zypp/sat/SolvIterMixin.h:21,
                 from /usr/include/zypp/sat/LocaleSupport.h:18,
                 from
/home/abuild/rpmbuild/BUILD/libyui-4.2.1/libyui-ncurses-pkg/src/NCPkgFilterPattern.cc:44:
/usr/include/c++/11/bits/stl_tree.h: In instantiation of ‘static const _Key&
std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::_S_key(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare,
_Alloc>::_Const_Link_type) [with _Key =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >;
_Val = std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >; _KeyOfValue =
std::_Identity<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; _Compare = paircmp; _Alloc =
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; std::_Rb_tree<_Key, _Val, _KeyOfValue,
_Compare, _Alloc>::_Const_Link_type = const
std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >*]’:
/usr/include/c++/11/bits/stl_tree.h:2069:47:   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 =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >;
_Val = std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >; _KeyOfValue =
std::_Identity<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; _Compare = paircmp; _Alloc =
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; std::_Rb_tree<_Key, _Val, _KeyOfValue,
_Compare, _Alloc>::key_type = std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >]’
/usr/include/c++/11/bits/stl_tree.h:2122:4:   required from
‘std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val,
_KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >;
_Key = std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >; _Val =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >;
_KeyOfValue = std::_Identity<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; _Compare = paircmp; _Alloc =
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >]’
/usr/include/c++/11/bits/stl_set.h:521:25:   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>::insert(std::set<_Key, _Compare,
_Alloc>::value_type&&) [with _Key = std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >; _Compare = paircmp; _Alloc =
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; typename std::_Rb_tree<_Key, _Key,
std::_Identity<_Tp>, _Compare, typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other>::const_iterator =
std::_Rb_tree<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >, std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> >,
std::_Identity<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >, paircmp,
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > > >::const_iterator; typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key>::other =
std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; typename
__gnu_cxx::__alloc_traits<_Alloc>::rebind<_Key> =
__gnu_cxx::__alloc_traits<std::allocator<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >,
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >
>::rebind<std::pair<std::__cxx11::basic_string<char>,
std::__cxx11::basic_string<char> > >; typename _Alloc::value_type =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >;
std::set<_Key, _Compare, _Alloc>::value_type =
std::pair<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char>
>]’
/home/abuild/rpmbuild/BUILD/libyui-4.2.1/libyui-ncurses-pkg/src/NCPkgFilterPattern.cc:343:28:
  required from here
/usr/include/c++/11/bits/stl_tree.h:770:8: error: static assertion failed:
comparison object must be invocable as const
  770 | 
      |        ^                                                        
/usr/include/c++/11/bits/stl_tree.h:770:8: note: ‘std::is_invocable_v<const
paircmp&, const std::pair<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >
>&, const std::pair<std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > >&>’ evaluates to false

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
@ 2021-04-23  7:28 ` marxin at gcc dot gnu.org
  2021-04-23  7:28 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-23  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Created attachment 50656
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50656&action=edit
test-case

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
  2021-04-23  7:28 ` [Bug libstdc++/100226] " marxin at gcc dot gnu.org
@ 2021-04-23  7:28 ` marxin at gcc dot gnu.org
  2021-04-23  7:33 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-23  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |redi at gcc dot gnu.org
   Last reconfirmed|                            |2021-04-23
             Status|UNCONFIRMED                 |NEW

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
  2021-04-23  7:28 ` [Bug libstdc++/100226] " marxin at gcc dot gnu.org
  2021-04-23  7:28 ` marxin at gcc dot gnu.org
@ 2021-04-23  7:33 ` rguenth at gcc dot gnu.org
  2021-04-23  8:25 ` redi at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-04-23  7:33 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.3.0
   Target Milestone|---                         |11.0
           Keywords|                            |needs-reduction,
                   |                            |rejects-valid

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I guess you want to uninclude it and reduce it w/o expanding the std library
headers.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-04-23  7:33 ` rguenth at gcc dot gnu.org
@ 2021-04-23  8:25 ` redi at gcc dot gnu.org
  2021-04-23  8:27 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-23  8:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The static assert was added intentionally, the comparison function used with
the container must have a const-qualified operator().

I would check that in the nurses code first.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2021-04-23  8:25 ` redi at gcc dot gnu.org
@ 2021-04-23  8:27 ` redi at gcc dot gnu.org
  2021-04-23  8:31 ` marxin at gcc dot gnu.org
  2021-04-23  8:35 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-23  8:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The template argument '_Compare = paircmp' shows the type user as the
comparison object.

So paircmp::operator() needs to be const.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2021-04-23  8:27 ` redi at gcc dot gnu.org
@ 2021-04-23  8:31 ` marxin at gcc dot gnu.org
  2021-04-23  8:35 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-23  8:31 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #4)
> The template argument '_Compare = paircmp' shows the type user as the
> comparison object.
> 
> So paircmp::operator() needs to be const.

I can confirm that it works, thank you for help!

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [Bug libstdc++/100226] [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const
  2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2021-04-23  8:31 ` marxin at gcc dot gnu.org
@ 2021-04-23  8:35 ` redi at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-04-23  8:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Bug 89370 would really help simplify this diagnostic.

The last three lines would be:

.../src/NCPkgFilterPattern.cc:343:28:   required from here
/usr/include/c++/11/bits/stl_tree.h:770:8: error: static assertion failed:
comparison object must be invocable as const
  770 | 
      |        ^                                                        
/usr/include/c++/11/bits/stl_tree.h:770:8: note: ‘std::is_invocable_v<const
paircmp&, const std::pair<std::string, std::string&, const
std::pair<std::string, std::string&>’ evaluates to false

Which is pretty clear, I think.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-04-23  8:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23  7:27 [Bug libstdc++/100226] New: [11/12 Regression] c++/11/bits/stl_tree.h:770:8: error: static assertion failed: comparison object must be invocable as const marxin at gcc dot gnu.org
2021-04-23  7:28 ` [Bug libstdc++/100226] " marxin at gcc dot gnu.org
2021-04-23  7:28 ` marxin at gcc dot gnu.org
2021-04-23  7:33 ` rguenth at gcc dot gnu.org
2021-04-23  8:25 ` redi at gcc dot gnu.org
2021-04-23  8:27 ` redi at gcc dot gnu.org
2021-04-23  8:31 ` marxin at gcc dot gnu.org
2021-04-23  8:35 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).