]> granicus.if.org Git - clang/commitdiff
Make the error about assigning to lambda-captured variables
authorJohn McCall <rjmccall@apple.com>
Tue, 13 Mar 2012 01:10:51 +0000 (01:10 +0000)
committerJohn McCall <rjmccall@apple.com>
Tue, 13 Mar 2012 01:10:51 +0000 (01:10 +0000)
clearer, and mention the existence of mutable lambdas.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152598 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
test/SemaCXX/lambda-expressions.cpp

index bdad36a982c761fb17d4ca9cfe6195a88e24f2b1..d859f37ad00c8fbd0ea2799f75e0458ad8da8fd9 100644 (file)
@@ -4388,7 +4388,7 @@ def err_typecheck_duplicate_vector_components_not_mlvalue : Error<
 def err_block_decl_ref_not_modifiable_lvalue : Error<
   "variable is not assignable (missing __block type specifier)">;
 def err_lambda_decl_ref_not_modifiable_lvalue : Error<
-  "variable is not assignable (captured by copy)">;
+  "cannot assign to a variable captured by copy in a non-mutable lambda">;
 def err_typecheck_call_not_function : Error<
   "called object type %0 is not a function or function pointer">;
 def err_call_incomplete_return : Error<
index 80ba0a1d035ba92fe391b181776893cd0fed340c..e91dee92edb11ac1828717e8f83b646576638b3f 100644 (file)
@@ -144,7 +144,7 @@ namespace ModifyingCapture {
   void test() {
     int n = 0;
     [=] {
-      n = 1; // expected-error {{variable is not assignable (captured by copy)}}
+      n = 1; // expected-error {{cannot assign to a variable captured by copy in a non-mutable lambda}}
     };
   }
 }