[cfe-commits] r150239 - /cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp

David Blaikie dblaikie at gmail.com
Fri Feb 10 07:56:06 PST 2012


On Fri, Feb 10, 2012 at 1:37 AM, Douglas Gregor <dgregor at apple.com> wrote:
> Author: dgregor
> Date: Fri Feb 10 03:37:05 2012
> New Revision: 150239
>
> URL: http://llvm.org/viewvc/llvm-project?rev=150239&view=rev
> Log:
> Add a lambda example from the working draft.
>
> Modified:
>    cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
>
> Modified: cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp?rev=150239&r1=150238&r2=150239&view=diff
> ==============================================================================
> --- cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp (original)
> +++ cfe/trunk/test/CXX/expr/expr.prim/expr.prim.lambda/p8.cpp Fri Feb 10 03:37:05 2012
> @@ -14,3 +14,12 @@
>     (void)[&, this] () {};
>   }
>  };
> +
> +struct S2 { void f(int i); };
> +
> +void S2::f(int i) {
> +  (void)[&, i]{ };
> +  (void)[&, &i]{ }; // expected-error{{'&' cannot precede a capture when the capture default is '&'}}
> +  (void)[=, this]{ }; // expected-error{{'this' cannot appear in a capture list when the capture default is '='}}

Diagnostic text - should that be 'this' can only be explicitly
captured by reference when the default capture is '='? (the way it
reads now it sounds like 'this' cannot be captured at all if the
default capture is '=' - but I know it can get a bit verbose/difficult
to read if one is too explicit/pedantic)

> +  (void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list