diff --git lib/AST/Expr.cpp lib/AST/Expr.cpp
index 24361ef..721385e 100644
--- lib/AST/Expr.cpp
+++ lib/AST/Expr.cpp
@@ -2297,11 +2297,6 @@ Expr *Expr::IgnoreParenImpCasts() {
       E = Materialize->GetTemporaryExpr();
       continue;
     }
-    if (SubstNonTypeTemplateParmExpr *NTTP
-                                  = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
-      E = NTTP->getReplacement();
-      continue;
-    }
     return E;
   }
 }
diff --git lib/Sema/SemaChecking.cpp lib/Sema/SemaChecking.cpp
index 2594648..7c0b871 100644
--- lib/Sema/SemaChecking.cpp
+++ lib/Sema/SemaChecking.cpp
@@ -4484,16 +4484,25 @@ void CheckImplicitConversion(Sema &S, Expr *E, QualType T,
     return;
   }
 
-  if ((E->isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull)
-           == Expr::NPCK_GNUNull) && !Target->isAnyPointerType()
-      && !Target->isBlockPointerType() && !Target->isMemberPointerType()) {
-    SourceLocation Loc = E->getSourceRange().getBegin();
-    if (Loc.isMacroID())
-      Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;
-    if (!Loc.isMacroID() || CC.isMacroID())
-      S.Diag(Loc, diag::warn_impcast_null_pointer_to_integer)
-          << T << clang::SourceRange(CC)
-          << FixItHint::CreateReplacement(Loc, S.getFixItZeroLiteralForType(T));
+  Expr::NullPointerConstantKind x = E->isNullPointerConstant(S.Context, Expr::NPC_ValueDependentIsNotNull);
+  if (!Target->isAnyPointerType() && !Target->isBlockPointerType() && !Target->isMemberPointerType()) {
+    if (x == Expr::NPCK_GNUNull) {
+      SourceLocation Loc = E->getSourceRange().getBegin();
+      if (Loc.isMacroID())
+        Loc = S.SourceMgr.getImmediateExpansionRange(Loc).first;
+      if (!Loc.isMacroID() || CC.isMacroID())
+        S.Diag(Loc, diag::warn_impcast_null_pointer_to_integer)
+            << T << clang::SourceRange(CC)
+            << FixItHint::CreateReplacement(Loc, S.getFixItZeroLiteralForType(T));
+    }
+  } else if (x == Expr::NPCK_ZeroExpression) {
+    if (S.Context.hasSameUnqualifiedType(E->getType(), S.Context.BoolTy))
+      S.DiagRuntimeBehavior(E->getExprLoc(), E,
+                          S.PDiag(diag::warn_impcast_bool_to_null_pointer)
+                            << T << E->getSourceRange());
+    else if (!S.isUnevaluatedContext())
+      S.Diag(E->getExprLoc(), diag::warn_non_literal_null_pointer)
+        << T << E->getSourceRange();
   }
 
   if (!Source->isIntegerType() || !Target->isIntegerType())
diff --git lib/Sema/SemaOverload.cpp lib/Sema/SemaOverload.cpp
index a874489..904ed7b 100644
--- lib/Sema/SemaOverload.cpp
+++ lib/Sema/SemaOverload.cpp
@@ -2558,21 +2558,9 @@ bool Sema::CheckPointerConversion(Expr *From, QualType ToType,
                                   CXXCastPath& BasePath,
                                   bool IgnoreBaseAccess) {
   QualType FromType = From->getType();
-  bool IsCStyleOrFunctionalCast = IgnoreBaseAccess;
 
   Kind = CK_BitCast;
 
-  if (!IsCStyleOrFunctionalCast && !FromType->isAnyPointerType() &&
-      From->isNullPointerConstant(Context, Expr::NPC_ValueDependentIsNotNull) ==
-      Expr::NPCK_ZeroExpression) {
-    if (Context.hasSameUnqualifiedType(From->getType(), Context.BoolTy))
-      DiagRuntimeBehavior(From->getExprLoc(), From,
-                          PDiag(diag::warn_impcast_bool_to_null_pointer)
-                            << ToType << From->getSourceRange());
-    else if (!isUnevaluatedContext())
-      Diag(From->getExprLoc(), diag::warn_non_literal_null_pointer)
-        << ToType << From->getSourceRange();
-  }
   if (const PointerType *ToPtrType = ToType->getAs<PointerType>()) {
     if (const PointerType *FromPtrType = FromType->getAs<PointerType>()) {
       QualType FromPointeeType = FromPtrType->getPointeeType(),
diff --git test/Sema/i-c-e.c test/Sema/i-c-e.c
index ee61ac3..8fbbfee 100644
--- test/Sema/i-c-e.c
+++ test/Sema/i-c-e.c
@@ -28,7 +28,7 @@ struct c {
 
 
 
-void test1(int n, int* p) { *(n ? p : (void *)(7-7)) = 1; }
+void test1(int n, int* p) { *(n ? p : (void *)(7-7)) = 1; } // expected-warning{{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
 void test2(int n, int* p) { *(n ? p : (void *)0) = 1; }
 
 
diff --git test/SemaCXX/type-convert-construct.cpp test/SemaCXX/type-convert-construct.cpp
index 479af21..f2b602d 100644
--- test/SemaCXX/type-convert-construct.cpp
+++ test/SemaCXX/type-convert-construct.cpp
@@ -9,7 +9,7 @@ void f() {
   int v5 = int; // expected-error {{expected '(' for function-style cast or type construction}}
   typedef int T;
   int *p;
-  bool v6 = T(0) == p;
+  bool v6 = T(0) == p; // expected-warning{{expression which evaluates to zero treated as a null pointer constant of type 'int *'}}
   char *str;
   str = "a string"; // expected-warning{{conversion from string literal to 'char *' is deprecated}}
   wchar_t *wstr;
