Oh dear. I regret to inform you that commit ab816a274505933da2f854014b54901c3c3db9d2 might be unfortunate

Pedro Alves palves@redhat.com
Mon Oct 2 09:39:00 GMT 2017


On 10/02/2017 03:04 AM, Tom Tromey wrote:
>>>>>> "Sergio" == Sergio Durigan Junior <sergiodj@redhat.com> writes:
> 
> Sergio> /usr/include/c++/4.8/bits/stl_algo.h:2245:19: error: passing ‘const ada_exc_info’ as ‘this’ argument of ‘bool ada_exc_info::operator<(const ada_exc_info&)’ discards qualifiers [-fpermissive]
> 
> I don't really understand this error, 

I have a local build of gcc 4.8.5, and I see the same.  The const is
coming from here:

/opt/gcc-4.8/include/c++/4.8.5/bits/stl_algo.h: In instantiation of ‘_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&) [with _RandomAccessIterator = 
                                                                         ^^^^^^^^^^
__gnu_cxx::__normal_iterator<ada_exc_info*, std::vector<ada_exc_info> >; _Tp = ada_exc_info]’:
                                                                         ^^^^^^^^^^^^^^^^^^

I think that was a bug in libstdc++.  std::__unguarded_partition no longer take
'const _Tp&' in the current sources.  Git blame points at:

  https://gcc.gnu.org/ml/libstdc++/2012-04/msg00074.html

where François wrote (emphasis mine):

~~~~
 - __unguarded_partition used to have 3 template parameters: _RandomAccessIterator, _Tp and _Compare. It was taking a const reference 
                                                                                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 to _Tp which was a useless constraint for the functor. So it now only have 2 template parameters, const _Tp& has been replaced by 
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 iterator_traits<_RandomAccessIterator>::reference.
~~~~

and especially why I don't see it
> (and didn't see it from try?), but I wonder if changing operator< and
> operator== to const-qualified would help.
> 
> The appended is an attempt but I'm not sure how to test it now.

Yes, I also think that that's the right fix.  I've pushed it in now.

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list