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;
+++ /dev/null
-// 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}}