From: Bill Wendling Date: Tue, 19 Nov 2013 18:41:11 +0000 (+0000) Subject: Merging r195126: X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f41e20ae7a36806d148f0e50fa8e9339b5d759a4;p=clang 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 8ec58d4283..22242a5acc 100644 --- a/lib/Sema/SemaExpr.cpp +++ b/lib/Sema/SemaExpr.cpp @@ -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 index 8ac8c5c9d3..0000000000 --- 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}}