]> granicus.if.org Git - clang/commitdiff
Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11...
authorEli Friedman <eli.friedman@gmail.com>
Mon, 6 Feb 2012 21:50:18 +0000 (21:50 +0000)
committerEli Friedman <eli.friedman@gmail.com>
Mon, 6 Feb 2012 21:50:18 +0000 (21:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149908 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/Decl.cpp
test/SemaCXX/lambda-expressions.cpp

index 123b14c0560f47edaa42d3d5b790340bedf881f5..76d8ec06bf880ece5155ebddb87596d00b7ecc8f 100644 (file)
@@ -1413,7 +1413,7 @@ APValue *VarDecl::evaluateValue(
   // 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;
index 05aba53dbbacf93f6202521d135655391c421130..46c74c3c74e6dd4ed923589166fda832df1d24fe 100644 (file)
@@ -79,5 +79,8 @@ namespace ImplicitCapture {
     [=]() { 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}}
   }
 }