aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/builtin4.C
blob: 567bb933fde565aa6acf623332aa451594d64612 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// DR 1512
// PR c++/87699
// { dg-do compile { target c++11 } }

using nullptr_t = decltype(nullptr);

template<typename T>
struct S { operator T(); };

void
fn ()
{
  S<nullptr_t> s;
  // Make sure we create a builtin operator overload candidate for == and !=.
  if (s == s) { }
  if (s != s) { }

  // But not for these.
  if (s > s) { }    // { dg-error "no match for" }
  if (s < s) { }    // { dg-error "no match for" }
  if (s <= s) { }   // { dg-error "no match for" }
  if (s >= s) { }   // { dg-error "no match for" }

  S<int *> r;
  if (s == r) { }   // { dg-error "no match for" }
  if (s != r) { }   // { dg-error "no match for" }
  if (s > r) { }    // { dg-error "no match for" }
  if (s < r) { }    // { dg-error "no match for" }
  if (s >= r) { }   // { dg-error "no match for" }
  if (s <= r) { }   // { dg-error "no match for" }
}