This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] std::equal using wrong concept check
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Subject: [v3] std::equal using wrong concept check
- From: Phil Edwards <pedwards at disaster dot jaj dot com>
- Date: Fri, 13 Apr 2001 05:49:05 -0400
This has apparently been wrong ever since the initial SGI implementation
of concept checking, but has just now been exposed (by the change from x !=
y to !(x==y)) in std::equal.
These checks used to see that the comparisons foo == foo and bar == bar
were valid, but what should have been tested all along was foo == bar.
This also fixes a linking error that shows up in the library testsuite;
in checking the wrong code, we were calling a nonexistant instantiation.
Tested on i686-linux and applied to trunk.
2001-04-13 Phil Edwards <pme@sources.redhat.com>
* include/bits/stl_algobase.h (equal): Use EqualOpConcept instead
of EqualityComparableConcept.
Index: include/bits/stl_algobase.h
===================================================================
RCS file: /cvs/gcc/gcc/libstdc++-v3/include/bits/stl_algobase.h,v
retrieving revision 1.8
diff -u -3 -p -r1.8 stl_algobase.h
--- stl_algobase.h 2001/04/13 09:03:18 1.8
+++ stl_algobase.h 2001/04/13 09:27:55
@@ -534,9 +534,8 @@ inline bool equal(_InputIter1 __first1,
// concept requirements
__glibcpp_function_requires(_InputIteratorConcept<_InputIter1>);
__glibcpp_function_requires(_InputIteratorConcept<_InputIter2>);
- __glibcpp_function_requires(_EqualityComparableConcept<
- typename iterator_traits<_InputIter1>::value_type>);
- __glibcpp_function_requires(_EqualityComparableConcept<
+ __glibcpp_function_requires(_EqualOpConcept<
+ typename iterator_traits<_InputIter1>::value_type,
typename iterator_traits<_InputIter2>::value_type>);
for ( ; __first1 != __last1; ++__first1, ++__first2)