]> granicus.if.org Git - clang/commitdiff
Revert r194540, it breaks various C++ programs.
authorJoerg Sonnenberger <joerg@bec.de>
Tue, 19 Nov 2013 13:38:38 +0000 (13:38 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Tue, 19 Nov 2013 13:38:38 +0000 (13:38 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195126 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaExpr.cpp
test/Sema/warn-null.c [deleted file]

index 8ec58d4283de823f1759ef6ac6c56a114efddf30..22242a5acc9e10ce5fb167a31181e31f8e43de59 100644 (file)
@@ -10619,17 +10619,8 @@ bool Sema::DiagnoseAssignmentResult(AssignConvertType ConvTy,
 
   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 (file)
index 8ac8c5c..0000000
+++ /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}}