r196721 - Fix an assertion introduced by my previous refactoring.
Faisal Vali
faisalv at yahoo.com
Sun Dec 8 07:00:29 PST 2013
Author: faisalv
Date: Sun Dec 8 09:00:29 2013
New Revision: 196721
URL: http://llvm.org/viewvc/llvm-project?rev=196721&view=rev
Log:
Fix an assertion introduced by my previous refactoring.
Add back the test that was triggering the assertion (which I removed mistakenly thinking it was triggering just a warning and not an assertion). My error was brought to my attention by Rafael (Thanks!).
Modified:
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp
Modified: cfe/trunk/lib/Sema/SemaLambda.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLambda.cpp?rev=196721&r1=196720&r2=196721&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaLambda.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLambda.cpp Sun Dec 8 09:00:29 2013
@@ -181,12 +181,10 @@ Optional<unsigned> clang::getStackIndexO
return FailDistance;
const unsigned IndexOfCaptureReadyLambda = OptionalStackIndex.getValue();
- assert(
- ((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
- (S.getCurGenericLambda() && S.getCurGenericLambda()->ImpCaptureStyle !=
- sema::LambdaScopeInfo::ImpCap_None)) &&
- "The capture ready lambda for a potential capture can only be the "
- "current lambda if it is a generic lambda with an implicit capture");
+ assert(((IndexOfCaptureReadyLambda != (FunctionScopes.size() - 1)) ||
+ S.getCurGenericLambda()) &&
+ "The capture ready lambda for a potential capture can only be the "
+ "current lambda if it is a generic lambda with an implicit capture");
const sema::LambdaScopeInfo *const CaptureReadyLambdaLSI =
cast<sema::LambdaScopeInfo>(FunctionScopes[IndexOfCaptureReadyLambda]);
Modified: cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp?rev=196721&r1=196720&r2=196721&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp (original)
+++ cfe/trunk/test/SemaCXX/cxx1y-init-captures.cpp Sun Dec 8 09:00:29 2013
@@ -32,11 +32,18 @@ namespace variadic_expansion {
void h(int i, char c) { g(i, c); } //expected-note{{in instantiation}}
}
+namespace simple_init_captures {
+ void test() {
+ int i;
+ auto L = [i](auto a) { return i + a; };
+ L(3.14);
+ }
+}
namespace odr_use_within_init_capture {
int test() {
-
+
{ // no captures
const int x = 10;
auto L = [z = x + 2](int a) {
More information about the cfe-commits
mailing list