Clean up some minor white space issues in trans-decl.c and trans-expr.c
[official-gcc.git] / gcc / testsuite / g++.dg / torture / 20090329-1.C
blob0274a1944e5060abad6cdc1068f934c738ec0561
1 /* { dg-do compile } */
3 struct input_iterator_tag { };
4 template<typename _Category, typename _Tp, typename _Distance = long, typename _Pointer = _Tp*, typename _Reference = _Tp&>
5 struct iterator {
6     typedef _Category iterator_category;
7 };
8 template<typename _Iterator> struct iterator_traits {
9     typedef typename _Iterator::iterator_category iterator_category;
11 template<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         }
21 template<typename _II1, typename _II2, typename _Compare>
22 bool 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     }
34 void __assert_fail () throw () __attribute__ ((__noreturn__));
35 template<typename T> struct BoundsContainer { };
36 template<class T> class input_iterator_wrapper : public iterator<input_iterator_tag, T, long, T*, T&> {
37 public:
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++() { }
53 struct X { };
54 bool predicate(const X&, const X&) {
55     return true;
57 bool test2(input_iterator_wrapper<X>& x) {
58     return lexicographical_compare(x, x, x, x, predicate);