Index: include/clang/Sema/Sema.h
===================================================================
--- include/clang/Sema/Sema.h	(revision 199875)
+++ include/clang/Sema/Sema.h	(working copy)
@@ -7902,7 +7902,8 @@
   void CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
                           SourceLocation ReturnLoc,
                           bool isObjCMethod = false,
-                          const AttrVec *Attrs = 0);
+                          const AttrVec *Attrs = 0,
+                          const FunctionDecl *FD = 0);
 
   void CheckFloatComparison(SourceLocation Loc, Expr* LHS, Expr* RHS);
   void CheckImplicitConversions(Expr *E, SourceLocation CC = SourceLocation());
Index: lib/Sema/SemaStmt.cpp
===================================================================
--- lib/Sema/SemaStmt.cpp	(revision 199875)
+++ lib/Sema/SemaStmt.cpp	(working copy)
@@ -2943,29 +2943,8 @@
         RetValExp = Res.takeAs<Expr>();
       }
 
-      CheckReturnValExpr(RetValExp, FnRetType, ReturnLoc, isObjCMethod, Attrs);
-
-      // C++11 [basic.stc.dynamic.allocation]p4:
-      //   If an allocation function declared with a non-throwing
-      //   exception-specification fails to allocate storage, it shall return
-      //   a null pointer. Any other allocation function that fails to allocate
-      //   storage shall indicate failure only by throwing an exception [...]
-      if (const FunctionDecl *FD = getCurFunctionDecl()) {
-        OverloadedOperatorKind Op = FD->getOverloadedOperator();
-        if (Op == OO_New || Op == OO_Array_New) {
-          const FunctionProtoType *Proto
-            = FD->getType()->castAs<FunctionProtoType>();
-          bool ReturnValueNonNull;
-
-          if (!Proto->isNothrow(Context, /*ResultIfDependent*/true) &&
-              !RetValExp->isValueDependent() &&
-              RetValExp->EvaluateAsBooleanCondition(ReturnValueNonNull,
-                                                    Context) &&
-              !ReturnValueNonNull)
-            Diag(ReturnLoc, diag::warn_operator_new_returns_null)
-              << FD << getLangOpts().CPlusPlus11;
-        }
-      }
+      CheckReturnValExpr(RetValExp, FnRetType, ReturnLoc, isObjCMethod, Attrs,
+                         getCurFunctionDecl());
     }
 
     if (RetValExp) {
Index: lib/Sema/SemaChecking.cpp
===================================================================
--- lib/Sema/SemaChecking.cpp	(revision 199875)
+++ lib/Sema/SemaChecking.cpp	(working copy)
@@ -4386,7 +4386,8 @@
 Sema::CheckReturnValExpr(Expr *RetValExp, QualType lhsType,
                          SourceLocation ReturnLoc,
                          bool isObjCMethod,
-                         const AttrVec *Attrs) {
+                         const AttrVec *Attrs,
+                         const FunctionDecl *FD) {
   CheckReturnStackAddr(*this, RetValExp, lhsType, ReturnLoc);
 
   // Check if the return value is null but should not be.
@@ -4400,6 +4401,24 @@
           << (isObjCMethod ? 1 : 0) << RetValExp->getSourceRange();
       break;
     }
+
+  // C++11 [basic.stc.dynamic.allocation]p4:
+  //   If an allocation function declared with a non-throwing
+  //   exception-specification fails to allocate storage, it shall return
+  //   a null pointer. Any other allocation function that fails to allocate
+  //   storage shall indicate failure only by throwing an exception [...]
+  if (FD) {
+    OverloadedOperatorKind Op = FD->getOverloadedOperator();
+    if (Op == OO_New || Op == OO_Array_New) {
+      const FunctionProtoType *Proto
+        = FD->getType()->castAs<FunctionProtoType>();
+      if (!Proto->isNothrow(Context, /*ResultIfDependent*/true) &&
+          !RetValExp->isValueDependent() &&
+          CheckNonNullExpr(*this, RetValExp))
+        Diag(ReturnLoc, diag::warn_operator_new_returns_null)
+          << FD << getLangOpts().CPlusPlus11;
+    }
+  }
 }
 
 //===--- CHECK: Floating-Point comparisons (-Wfloat-equal) ---------------===//
