Merging r195126:
------------------------------------------------------------------------
r195126 | joerg | 2013-11-19 05:38:38 -0800 (Tue, 19 Nov 2013) | 2 lines
Revert r194540, it breaks various C++ programs.
------------------------------------------------------------------------
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_34@195139 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 8ec58d4..22242a5 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -10619,17 +10619,8 @@
switch (ConvTy) {
case Compatible:
- // See if a proper null pointer constant is to be assigned.
- if (DstType->isAnyPointerType() && !SrcType->isAnyPointerType() &&
- SrcExpr->isNullPointerConstant(Context,
- Expr::NPC_NeverValueDependent) ==
- Expr::NPCK_ZeroExpression &&
- !isUnevaluatedContext())
- Diag(SrcExpr->getExprLoc(), diag::warn_non_literal_null_pointer)
- << DstType << SrcExpr->getSourceRange();
-
- DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
- return false;
+ DiagnoseAssignmentEnum(DstType, SrcType, SrcExpr);
+ return false;
case PointerToInt:
DiagKind = diag::ext_typecheck_convert_pointer_int;
diff --git a/test/Sema/warn-null.c b/test/Sema/warn-null.c
deleted file mode 100644
index 8ac8c5c..0000000
--- a/test/Sema/warn-null.c
+++ /dev/null
@@ -1,6 +0,0 @@
-// RUN: %clang_cc1 %s -verify -fsyntax-only
-
-// 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}}