aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp2a/concepts-friend15.C
blob: c37d547bbdfab1cfd7138f159baeb74fef4c366c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// PR c++/109751
// { dg-do compile { target c++20 } }

template<typename _Tp> concept cmpeq
  = requires(_Tp __t, _Tp __u) { { __u != __t } ; };

template<typename D>
struct iterator_interface
{
  friend constexpr bool operator>=(D lhs, D rhs)
    requires cmpeq<D> { return true; }
};

template<typename T>
struct iterator : iterator_interface<iterator<T>>
{
    bool operator==(iterator) const;
    iterator &operator++();
    iterator &operator++(int);
};

static_assert(cmpeq<iterator<int>>);