2011-06-18 04:35:48 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -verify -Wnull-arithmetic %s
|
2011-06-17 05:36:56 +08:00
|
|
|
#define NULL __null
|
|
|
|
|
|
|
|
@interface X
|
|
|
|
@end
|
|
|
|
|
|
|
|
void f() {
|
|
|
|
bool b;
|
|
|
|
X *d;
|
2016-10-22 06:00:42 +08:00
|
|
|
b = d < NULL || NULL < d || d > NULL || NULL > d; // expected-error 4{{ordered comparison between pointer and zero}}
|
|
|
|
b = d <= NULL || NULL <= d || d >= NULL || NULL >= d; // expected-error 4{{ordered comparison between pointer and zero}}
|
2011-06-17 05:36:56 +08:00
|
|
|
b = d == NULL || NULL == d || d != NULL || NULL != d;
|
|
|
|
}
|