xref: /llvm-project/clang/test/SemaObjCXX/null_objc_pointer.mm (revision 5e9746f520e6bbeafc36b8a23585b2e6117e1a7a)
1// RUN: %clang_cc1 -fsyntax-only -verify -Wnull-arithmetic %s
2#define NULL __null
3
4@interface X
5@end
6
7void f() {
8  bool b;
9  X *d;
10  b = d < NULL || NULL < d || d > NULL || NULL > d; // expected-error 4{{ordered comparison between pointer and zero}}
11  b = d <= NULL || NULL <= d || d >= NULL || NULL >= d; // expected-error 4{{ordered comparison between pointer and zero}}
12  b = d == NULL || NULL == d || d != NULL || NULL != d;
13}
14