1/* { dg-do compile } */ 2 3struct input_iterator_tag { }; 4template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&> 5struct iterator { 6 typedef _Category iterator_category; 7}; 8template<typename _Iterator> struct iterator_traits { 9 typedef typename _Iterator::iterator_category iterator_category; 10}; 11template<typename, typename> struct __lc_rai { 12 template<typename _II1, typename _II2> 13 static _II1 __newlast1(_II1, _II1 __last1, _II2, _II2) { 14 return __last1; 15 } 16 template<typename _II> 17 static bool __cnd2(_II __first, _II __last) { 18 return __first != __last; 19 } 20}; 21template<typename _II1, typename _II2, typename _Compare> 22bool lexicographical_compare(_II1 __first1, _II1 __last1, _II2 __first2, 23 _II2 __last2, _Compare __comp) { 24 typedef typename iterator_traits<_II1>::iterator_category _Category1; 25 typedef typename iterator_traits<_II2>::iterator_category _Category2; 26 typedef __lc_rai<_Category1, _Category2> __rai_type; 27 __last1 = __rai_type::__newlast1(__first1, __last1, __first2, __last2); 28 for (; 29 __first1 != __last1 && __rai_type::__cnd2(__first2, __last2); 30 ++__first1, ++__first2) { 31 if (__comp(*__first1, *__first2)) return true; 32 } 33} 34void __assert_fail () throw () __attribute__ ((__noreturn__)); 35template<typename T> struct BoundsContainer { }; 36template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> { 37public: 38 typedef BoundsContainer<T> ContainerType; 39 T* ptr; 40 ContainerType* SharedInfo; 41 input_iterator_wrapper(const input_iterator_wrapper& in) : ptr(in.ptr), SharedInfo(in.SharedInfo) { } 42 bool operator==(const input_iterator_wrapper& in) const { 43 (static_cast<void> ((SharedInfo != __null 44 && SharedInfo == in.SharedInfo) 45 ? 0 : (__assert_fail (), 0))); 46 } 47 bool operator!=(const input_iterator_wrapper& in) const { 48 return !(*this == in); 49 } 50 T& operator*() const { } 51 input_iterator_wrapper& operator++() { } 52}; 53struct X { }; 54bool predicate(const X&, const X&) { 55 return true; 56} 57bool test2(input_iterator_wrapper<X>& x) { 58 return lexicographical_compare(x, x, x, x, predicate); 59} 60