Merging r195303:
------------------------------------------------------------------------
r195303 | rsmith | 2013-11-20 17:53:02 -0800 (Wed, 20 Nov 2013) | 4 lines

PR10837: Warn if a null pointer constant is formed by a zero integer constant
expression that is not a zero literal, in C. This is a different, and more
targeted, approach than that in r194540.

------------------------------------------------------------------------


git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195815 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/warn-null.c b/test/Sema/warn-null.c
new file mode 100644
index 0000000..28fb6a5
--- /dev/null
+++ b/test/Sema/warn-null.c
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 %s -verify
+
+// PR10837: Warn if a non-pointer-typed expression is folded to a null pointer
+int *p = 0;
+int *q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
+int *r = (1 - 1); // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
+void f() {
+  p = 0;
+  q = '\0'; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
+  r = 1 - 1; // expected-warning{{expression which evaluates to zero treated as a null pointer constant}}
+}