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

--- Comment #12 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jonathan Wakely from comment #11)
> (In reply to David Binderman from comment #10)
> > I am still not sure if the new code is ok or not,
> 
> Wasn't "This is 400% wrong" clear?

Here's the error it caused:

/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/parallel/multiway_merge.h:273:
error: no match for 'operator<' in '__seq2 < __seq0' (operand types are
'__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short unsigned
int*, std::vector<short unsigned int> >, std::less<short unsigned int> >' and
'__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short unsigned
int*, std::vector<short unsigned int> >, std::less<short unsigned int> >')
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/parallel/multiway_merge.h:120:
note: candidate: 'bool
__gnu_parallel::operator<(__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short
unsigned int*, std::vector<short unsigned int> >, std::less<short unsigned int>
>&, __gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short
unsigned int*, std::vector<short unsigned int> >, const std::less<short
unsigned int> >&)'
/home/jwakely/build/powerpc64le-unknown-linux-gnu/libstdc++-v3/include/parallel/multiway_merge.h:121:
note:   no known conversion for argument 2 from
'__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short unsigned
int*, std::vector<short unsigned int> >, std::less<short unsigned int> >' to
'__gnu_parallel::_GuardedIterator<__gnu_cxx::__normal_iterator<short unsigned
int*, std::vector<short unsigned int> >, const std::less<short unsigned int>
>&'


And the reason it's wrong is that const Foo<T, U>& and Foo<T, const U>& are
completely different things. Your patch made *one* of the parameters Foo<T,
const U>& (which is wrong because it's never called with anything matching that
type) and left the other parameter unchanged (which is even more wrong, because
now the operator can't be used to compare two objects of the same type).



( https://gcc.gnu.org/pipermail/gcc-patches/2020-May/545214.html

Reply via email to