| 1 |
// RUN: %clang_cc1 -std=c++11 -verify %s -Wno-tautological-compare |
| 2 |
|
| 3 |
struct A { operator decltype(nullptr)(); }; // expected-note 16{{implicitly converted}} |
| 4 |
struct B { operator const int *(); }; // expected-note 8{{implicitly converted}} |
| 5 |
void f(A a, B b, volatile int *pi) { |
| 6 |
(void)(a == a); |
| 7 |
(void)(a != a); |
| 8 |
(void)(a < a); // expected-error {{invalid operands}} |
| 9 |
(void)(a > a); // expected-error {{invalid operands}} |
| 10 |
(void)(a <= a); // expected-error {{invalid operands}} |
| 11 |
(void)(a >= a); // expected-error {{invalid operands}} |
| 12 |
|
| 13 |
(void)(a == b); |
| 14 |
(void)(a != b); |
| 15 |
(void)(a < b); // expected-error {{invalid operands}} |
| 16 |
(void)(a > b); // expected-error {{invalid operands}} |
| 17 |
(void)(a <= b); // expected-error {{invalid operands}} |
| 18 |
(void)(a >= b); // expected-error {{invalid operands}} |
| 19 |
|
| 20 |
(void)(b == a); |
| 21 |
(void)(b != a); |
| 22 |
(void)(b < a); // expected-error {{invalid operands}} |
| 23 |
(void)(b > a); // expected-error {{invalid operands}} |
| 24 |
(void)(b <= a); // expected-error {{invalid operands}} |
| 25 |
(void)(b >= a); // expected-error {{invalid operands}} |
| 26 |
|
| 27 |
(void)(a == pi); |
| 28 |
(void)(a != pi); |
| 29 |
(void)(a < pi); // expected-error {{invalid operands}} |
| 30 |
(void)(a > pi); // expected-error {{invalid operands}} |
| 31 |
(void)(a <= pi); // expected-error {{invalid operands}} |
| 32 |
(void)(a >= pi); // expected-error {{invalid operands}} |
| 33 |
|
| 34 |
(void)(pi == a); |
| 35 |
(void)(pi != a); |
| 36 |
(void)(pi < a); // expected-error {{invalid operands}} |
| 37 |
(void)(pi > a); // expected-error {{invalid operands}} |
| 38 |
(void)(pi <= a); // expected-error {{invalid operands}} |
| 39 |
(void)(pi >= a); // expected-error {{invalid operands}} |
| 40 |
|
| 41 |
(void)(b == pi); |
| 42 |
(void)(b != pi); |
| 43 |
(void)(b < pi); |
| 44 |
(void)(b > pi); |
| 45 |
(void)(b <= pi); |
| 46 |
(void)(b >= pi); |
| 47 |
|
| 48 |
(void)(pi == b); |
| 49 |
(void)(pi != b); |
| 50 |
(void)(pi < b); |
| 51 |
(void)(pi > b); |
| 52 |
(void)(pi <= b); |
| 53 |
(void)(pi >= b); |
| 54 |
|
| 55 |
(void)(b == b); |
| 56 |
(void)(b != b); |
| 57 |
(void)(b < b); |
| 58 |
(void)(b > b); |
| 59 |
(void)(b <= b); |
| 60 |
(void)(b >= b); |
| 61 |
|
| 62 |
(void)(pi == pi); |
| 63 |
(void)(pi != pi); |
| 64 |
(void)(pi < pi); |
| 65 |
(void)(pi > pi); |
| 66 |
(void)(pi <= pi); |
| 67 |
(void)(pi >= pi); |
| 68 |
} |
| 69 |
|
| 70 |
// FIXME: This is wrong: the type T = 'const volatile int * const * const *' |
| 71 |
// would work here, and there exists a builtin candidate for that type. |
| 72 |
struct C { operator const int ***(); }; |
| 73 |
void g(C c, volatile int ***p) { |
| 74 |
(void)(c < p); // expected-error {{invalid operands}} |
| 75 |
} |