Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11 mode.  PR11928.

llvm-svn: 149908
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp
index 123b14c..76d8ec0 100644
--- a/clang/lib/AST/Decl.cpp
+++ b/clang/lib/AST/Decl.cpp
@@ -1413,7 +1413,7 @@
   // expression as a side-effect.
   if (getASTContext().getLangOptions().CPlusPlus0x && !Eval->CheckedICE) {
     Eval->CheckedICE = true;
-    Eval->IsICE = Notes.empty();
+    Eval->IsICE = Result && Notes.empty();
   }
 
   return Result ? &Eval->Evaluated : 0;
diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp
index 05aba53..46c74c3 100644
--- a/clang/test/SemaCXX/lambda-expressions.cpp
+++ b/clang/test/SemaCXX/lambda-expressions.cpp
@@ -79,5 +79,8 @@
     [=]() { const G* gg = &g; return gg->a; }; // expected-error {{not supported yet}}
     [=]() { return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error {{no matching constructor for initialization of 'const ImplicitCapture::G'}} expected-error 2 {{not supported yet}}
     (void)^{ return [=]{ const G* gg = &g; return gg->a; }(); }; // expected-error 2 {{no matching constructor for initialization of 'const ImplicitCapture::G'}} expected-error {{not supported yet}}
+
+    const int h = a; // expected-note {{declared}}
+    []() { return h; }; // expected-error {{variable 'h' cannot be implicitly captured in a lambda with no capture-default specified}} expected-note {{lambda expression begins here}} expected-error {{not supported yet}}
   }
 }