[cfe-commits] r152593 - in /cfe/trunk: include/clang/AST/Expr.h include/clang/Basic/DiagnosticSemaKinds.td lib/AST/ExprClassification.cpp lib/Sema/SemaExpr.cpp test/SemaCXX/lambda-expressions.cpp

John McCall rjmccall at apple.com
Mon Mar 12 18:18:51 PDT 2012


On Mar 12, 2012, at 5:52 PM, Richard Smith wrote:
> On Mon, Mar 12, 2012 at 5:37 PM, John McCall <rjmccall at apple.com> wrote:
> Modified: cfe/trunk/test/SemaCXX/lambda-expressions.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/lambda-expressions.cpp?rev=152593&r1=152592&r2=152593&view=diff
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/lambda-expressions.cpp (original)
> +++ cfe/trunk/test/SemaCXX/lambda-expressions.cpp Mon Mar 12 19:37:01 2012
> @@ -139,3 +139,12 @@
>   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)}}
> 
> It would be great if this diagnostic mentioned that the lambda is not marked as 'mutable'.

I'd been vaguely unhappy with this diagnostic anyway, so I took this prompting to improve it in a couple dimensions.  r152598.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120312/42bd44da/attachment.html>


More information about the cfe-commits mailing list