// RUN: %clang_cc1 -fsyntax-only -verify %s -isystem %S/Inputs -Wzero-as-null-pointer-constant -std=c++11
// RUN: %clang_cc1 -fsyntax-only -verify %s -isystem %S/Inputs -DSYSTEM_WARNINGS -Wzero-as-null-pointer-constant -Wsystem-headers -std=c++11
;
int = nullptr;
void = nullptr;
void* p0 = nullptr;
int = 0; // expected-warning{{zero as null pointer constant}}
void = 0; // expected-warning{{zero as null pointer constant}}
void* p1 = 0; // expected-warning{{zero as null pointer constant}}
// NULL is an integer constant expression, so warn on it too:
void* p2 = __null; // expected-warning{{zero as null pointer constant}}
void = __null; // expected-warning{{zero as null pointer constant}}
int = __null; // expected-warning{{zero as null pointer constant}}
void ; // expected-warning{{zero as null pointer constant}}
void ; // expected-warning{{zero as null pointer constant}}
void ; // expected-warning{{zero as null pointer constant}}
void ; // expected-warning{{zero as null pointer constant}}
void ; // expected-warning{{zero as null pointer constant}}
void ;
void
// Warn on these too. Matches gcc and arguably makes sense.
void* pp = 0; // expected-warning{{zero as null pointer constant}}
void* pp2 = static_cast<decltype>; // expected-warning{{zero as null pointer constant}}
// Shouldn't warn.
void
void
// FIXME: this one probably should not warn.
void // expected-warning{{zero as null pointer constant}} expected-warning{{zero as null pointer constant}}
void
;
void
;
void
// Do not warn on *any* other macros from system headers, even if they
// expand to/their expansion contains NULL.
void* sys_init = SYSTEM_MACRO;
void* sys_init2 = OTHER_SYSTEM_MACRO;
void* sys_init = SYSTEM_MACRO; // expected-warning {{zero as null pointer constant}}
void* sys_init2 = OTHER_SYSTEM_MACRO; // expected-warning {{zero as null pointer constant}}