1 typedef __PTRDIFF_TYPE__ ptrdiff_t;
2
3 template <typename T>
4 class I
5 {
6 public:
7 typedef ptrdiff_t difference_type;
8 I ();
9 ~I ();
10 I (T *);
11 I (const I &);
12 T &operator * ();
13 T *operator -> ();
14 T &operator [] (const difference_type &) const;
15 I &operator = (const I &);
16 I &operator ++ ();
17 I operator ++ (int);
18 I &operator -- ();
19 I operator -- (int);
20 I &operator += (const difference_type &);
21 I &operator -= (const difference_type &);
22 I operator + (const difference_type &) const;
23 I operator - (const difference_type &) const;
24 template <typename S> friend bool operator == (I<S> &, I<S> &);
25 template <typename S> friend bool operator == (const I<S> &, const I<S> &);
26 template <typename S> friend bool operator < (I<S> &, I<S> &);
27 template <typename S> friend bool operator < (const I<S> &, const I<S> &);
28 template <typename S> friend bool operator <= (I<S> &, I<S> &);
29 template <typename S> friend bool operator <= (const I<S> &, const I<S> &);
30 template <typename S> friend bool operator > (I<S> &, I<S> &);
31 template <typename S> friend bool operator > (const I<S> &, const I<S> &);
32 template <typename S> friend bool operator >= (I<S> &, I<S> &);
33 template <typename S> friend bool operator >= (const I<S> &, const I<S> &);
34 template <typename S> friend typename I<S>::difference_type operator - (I<S> &, I<S> &);
35 template <typename S> friend typename I<S>::difference_type operator - (const I<S> &, const I<S> &);
36 template <typename S> friend I<S> operator + (typename I<S>::difference_type , const I<S> &);
37 private:
38 T *p;
39 };
40
41 template <typename T> bool operator == (I<T> &, I<T> &);
42 template <typename T> bool operator == (const I<T> &, const I<T> &);
43 template <typename T> bool operator != (I<T> &, I<T> &);
44 template <typename T> bool operator != (const I<T> &, const I<T> &);
45 template <typename T> bool operator < (I<T> &, I<T> &);
46 template <typename T> bool operator < (const I<T> &, const I<T> &);
47 template <typename T> bool operator <= (I<T> &, I<T> &);
48 template <typename T> bool operator <= (const I<T> &, const I<T> &);
49 template <typename T> bool operator > (I<T> &, I<T> &);
50 template <typename T> bool operator > (const I<T> &, const I<T> &);
51 template <typename T> bool operator >= (I<T> &, I<T> &);
52 template <typename T> bool operator >= (const I<T> &, const I<T> &);
53 template <typename T> typename I<T>::difference_type operator - (I<T> &, I<T> &);
54 template <typename T> typename I<T>::difference_type operator - (const I<T> &, const I<T> &);
55 template <typename T> I<T> operator + (typename I<T>::difference_type, const I<T> &);
56
57 void
f1(I<int> & x,I<int> & y)58 f1 (I<int> &x, I<int> &y)
59 {
60 I<int> i;
61 #pragma omp for collapse(2)
62 for (i = x; i < y; i++) // { dg-error "the same loop iteration variables 'i' used in multiple associated loops" }
63 for (i = x; i < y; i++)
64 ;
65 #pragma omp for collapse(2)
66 for (I<int> j = x; j < y; j++)// { dg-error "the same loop iteration variables 'j' used in multiple associated loops" }
67 for (j = y; j > x; j--)
68 ;
69 }
70