From 5fa2ef4445fa674f93fd87e6a1fc8f9582724b5c Mon Sep 17 00:00:00 2001 From: John McCall Date: Tue, 13 Mar 2012 00:37:01 +0000 Subject: Alternate fix to PR12248: put Sema in charge of special-casing the diagnostic for assigning to a copied block capture. This has the pleasant side-effect of letting us special-case the diagnostic for assigning to a copied lambda capture as well, without introducing a new non-modifiable enumerator for it. llvm-svn: 152593 --- clang/test/SemaCXX/lambda-expressions.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'clang/test/SemaCXX/lambda-expressions.cpp') diff --git a/clang/test/SemaCXX/lambda-expressions.cpp b/clang/test/SemaCXX/lambda-expressions.cpp index 99fc0caaf7a..80ba0a1d035 100644 --- a/clang/test/SemaCXX/lambda-expressions.cpp +++ b/clang/test/SemaCXX/lambda-expressions.cpp @@ -139,3 +139,12 @@ void PR12248() unsigned int result = 0; auto l = [&]() { ++result; }; } + +namespace ModifyingCapture { + void test() { + int n = 0; + [=] { + n = 1; // expected-error {{variable is not assignable (captured by copy)}} + }; + } +} -- cgit v1.2.3