foo.cc: In function ‘bool cmp(stu, stu)’:
foo.cc:8:33: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]
8 | return x.s>y.s||x.s==y.s&&x.xh<y.xh;
| ~~~~~~~~^~~~~~~~~~~
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/algorithm:61,
from stdc++.h:51:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h: In instantiation of ‘_OutputIterator std::__merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator, _Compare) [with _InputIterator1 = stu*; _InputIterator2 = stu*; _OutputIterator = bool (*)(stu, stu); _Compare = __gnu_cxx::__ops::_Iter_less_iter]’:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4876:37: required from ‘_OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter) [with _IIter1 = stu*; _IIter2 = stu*; _OIter = bool (*)(stu, stu)]’
4876 | return _GLIBCXX_STD_A::__merge(__first1, __last1,
| ^
foo.cc:39:8: required from here
39 | merge(lose+1,lose+1+n,win+1+n,a+1,cmp);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4820:25: error: assignment of read-only location ‘* __result’
4820 | *__result = *__first2;
| ~~~~~~~~~~^~~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4825:25: error: assignment of read-only location ‘* __result’
4825 | *__result = *__first1;
| ~~~~~~~~~~^~~~~~~~~~~
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algobase.h:71,
from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/algorithm:60:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/predefined_ops.h: In instantiation of ‘bool __gnu_cxx::__ops::_Iter_less_iter::operator()(_Iterator1, _Iterator2) const [with _Iterator1 = stu*; _Iterator2 = stu*]’:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4818:14: required from ‘_OutputIterator std::__merge(_InputIterator1, _InputIterator1, _InputIterator2, _InputIterator2, _OutputIterator, _Compare) [with _InputIterator1 = stu*; _InputIterator2 = stu*; _OutputIterator = bool (*)(stu, stu); _Compare = __gnu_cxx::__ops::_Iter_less_iter]’
4818 | if (__comp(__first2, __first1))
| ~~~~~~^~~~~~~~~~~~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algo.h:4876:37: required from ‘_OIter std::merge(_IIter1, _IIter1, _IIter2, _IIter2, _OIter) [with _IIter1 = stu*; _IIter2 = stu*; _OIter = bool (*)(stu, stu)]’
4876 | return _GLIBCXX_STD_A::__merge(__first1, __last1,
| ^
foo.cc:39:8: required from here
39 | merge(lose+1,lose+1+n,win+1+n,a+1,cmp);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/predefined_ops.h:45:23: error: no match for ‘operator<’ (operand types are ‘stu’ and ‘stu’)
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_algobase.h:67:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1241:5: note: candidate: ‘template<class _IteratorL, class _IteratorR, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_IteratorL, _Container>&, const __normal_iterator<_IteratorR, _Container>&)’
1241 | operator<(const __normal_iterator<_IteratorL, _Container>& __lhs,
| ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1241:5: note: template argument deduction/substitution failed:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/predefined_ops.h:45:23: note: ‘stu’ is not derived from ‘const __gnu_cxx::__normal_iterator<_IteratorL, _Container>’
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1249:5: note: candidate: ‘template<class _Iterator, class _Container> bool __gnu_cxx::operator<(const __normal_iterator<_Iterator, _Container>&, const __normal_iterator<_Iterator, _Container>&)’
1249 | operator<(const __normal_iterator<_Iterator, _Container>& __lhs,
| ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_iterator.h:1249:5: note: template argument deduction/substitution failed:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/predefined_ops.h:45:23: note: ‘stu’ is not derived from ‘const __gnu_cxx::__normal_iterator<_Iterator, _Container>’
45 | { return *__it1 < *__it2; }
| ~~~~~~~^~~~~~~~