diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-02-06 21:50:18 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-02-06 21:50:18 +0000 |
commit | 210386eb619ea9feef425636150bdffc0538574d (patch) | |
tree | 52b27d58c56331bdfb03eedb829974d15a2f57ce | |
parent | b4a3ef783cb3e9c8a927130d65385988a6aabaa3 (diff) |
Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11 mode. PR11928.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@149908 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/AST/Decl.cpp | 2 | ||||
-rw-r--r-- | test/SemaCXX/lambda-expressions.cpp | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp index 123b14c056..76d8ec06bf 100644 --- a/lib/AST/Decl.cpp +++ b/lib/AST/Decl.cpp @@ -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; diff --git a/test/SemaCXX/lambda-expressions.cpp b/test/SemaCXX/lambda-expressions.cpp index 05aba53dbb..46c74c3c74 100644 --- a/test/SemaCXX/lambda-expressions.cpp +++ b/test/SemaCXX/lambda-expressions.cpp @@ -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}} } } |