1 // RUN: %clang_cc1 -fsyntax-only -Wno-tautological-pointer-compare -fblocks -std=c++11 -verify %s
2 // RUN: %clang_cc1 -fsyntax-only -Wno-tautological-pointer-compare -fblocks -std=c++11 -verify %s -fexperimental-new-constant-interpreter
8 a
= 0 ? nullptr + a
: a
+ nullptr; // expected-error 2{{invalid operands to binary expression}}
9 a
= 0 ? nullptr - a
: a
- nullptr; // expected-error 2{{invalid operands to binary expression}}
10 a
= 0 ? nullptr / a
: a
/ nullptr; // expected-error 2{{invalid operands to binary expression}}
11 a
= 0 ? nullptr * a
: a
* nullptr; // expected-error 2{{invalid operands to binary expression}}
12 a
= 0 ? nullptr >> a
: a
>> nullptr; // expected-error 2{{invalid operands to binary expression}}
13 a
= 0 ? nullptr << a
: a
<< nullptr; // expected-error 2{{invalid operands to binary expression}}
14 a
= 0 ? nullptr % a
: a
% nullptr; // expected-error 2{{invalid operands to binary expression}}
15 a
= 0 ? nullptr & a
: a
& nullptr; // expected-error 2{{invalid operands to binary expression}}
16 a
= 0 ? nullptr | a
: a
| nullptr; // expected-error 2{{invalid operands to binary expression}}
17 a
= 0 ? nullptr ^ a
: a
^ nullptr; // expected-error 2{{invalid operands to binary expression}}
19 // Using two nullptrs should only give one error instead of two.
20 a
= nullptr + nullptr; // expected-error{{invalid operands to binary expression}}
21 a
= nullptr - nullptr; // expected-error{{invalid operands to binary expression}}
22 a
= nullptr / nullptr; // expected-error{{invalid operands to binary expression}}
23 a
= nullptr * nullptr; // expected-error{{invalid operands to binary expression}}
24 a
= nullptr >> nullptr; // expected-error{{invalid operands to binary expression}}
25 a
= nullptr << nullptr; // expected-error{{invalid operands to binary expression}}
26 a
= nullptr % nullptr; // expected-error{{invalid operands to binary expression}}
27 a
= nullptr & nullptr; // expected-error{{invalid operands to binary expression}}
28 a
= nullptr | nullptr; // expected-error{{invalid operands to binary expression}}
29 a
= nullptr ^ nullptr; // expected-error{{invalid operands to binary expression}}
31 a
+= nullptr; // expected-error{{invalid operands to binary expression}}
32 a
-= nullptr; // expected-error{{invalid operands to binary expression}}
33 a
/= nullptr; // expected-error{{invalid operands to binary expression}}
34 a
*= nullptr; // expected-error{{invalid operands to binary expression}}
35 a
>>= nullptr; // expected-error{{invalid operands to binary expression}}
36 a
<<= nullptr; // expected-error{{invalid operands to binary expression}}
37 a
%= nullptr; // expected-error{{invalid operands to binary expression}}
38 a
&= nullptr; // expected-error{{invalid operands to binary expression}}
39 a
|= nullptr; // expected-error{{invalid operands to binary expression}}
40 a
^= nullptr; // expected-error{{invalid operands to binary expression}}
42 b
= a
< nullptr || nullptr < a
; // expected-error 2{{invalid operands to binary expression}}
43 b
= a
> nullptr || nullptr > a
; // expected-error 2{{invalid operands to binary expression}}
44 b
= a
<= nullptr || nullptr <= a
; // expected-error 2{{invalid operands to binary expression}}
45 b
= a
>= nullptr || nullptr >= a
; // expected-error 2{{invalid operands to binary expression}}
46 b
= a
== nullptr || nullptr == a
; // expected-error 2{{invalid operands to binary expression}}
47 b
= a
!= nullptr || nullptr != a
; // expected-error 2{{invalid operands to binary expression}}
49 b
= &a
< nullptr || nullptr < &a
|| &a
> nullptr || nullptr > &a
; // expected-error 4{{invalid operands}}
50 b
= &a
<= nullptr || nullptr <= &a
|| &a
>= nullptr || nullptr >= &a
; // expected-error 4{{invalid operands}}
51 b
= &a
== nullptr || nullptr == &a
|| &a
!= nullptr || nullptr != &a
;
53 b
= nullptr < nullptr || nullptr > nullptr; // expected-error 2{{invalid operands to binary expression}}
54 b
= nullptr <= nullptr || nullptr >= nullptr; // expected-error 2{{invalid operands to binary expression}}
55 b
= nullptr == nullptr || nullptr != nullptr;
57 b
= ((nullptr)) != a
; // expected-error{{invalid operands to binary expression}}
61 b
= c
== nullptr || nullptr == c
|| c
!= nullptr || nullptr != c
;
66 b
= d
== nullptr || nullptr == d
|| d
!= nullptr || nullptr != d
;
69 b
= e
== nullptr || nullptr == e
|| e
!= nullptr || nullptr != e
;
72 b
= f
== nullptr || nullptr == f
|| f
!= nullptr || nullptr != f
;
73 b
= "f" == nullptr || nullptr == "f" || "f" != nullptr || nullptr != "f";