[cfe-commits] r149908 - in /cfe/trunk: lib/AST/Decl.cpp test/SemaCXX/lambda-expressions.cpp
Eli Friedman
eli.friedman at gmail.com
Mon Feb 6 13:50:19 PST 2012
Author: efriedma
Date: Mon Feb 6 15:50:18 2012
New Revision: 149908
URL: http://llvm.org/viewvc/llvm-project?rev=149908&view=rev
Log:
Fix the result of VarDecl::checkInitIsICE so it is consistently accurate in C++11 mode. PR11928.
Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/test/SemaCXX/lambda-expressions.cpp
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=149908&r1=149907&r2=149908&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Mon Feb 6 15:50:18 2012
@@ -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;
Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=149908&r1=149907&r2=149908&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original)
+++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Feb 6 15:50:18 2012
@@ -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}}
}
}
More information about the cfe-commits
mailing list