diff mbox

[C++] P0018R3, C++17 lambda capture of *this by value as [=,*this]

Message ID 20160927192245.GD7282@tucnak.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Sept. 27, 2016, 7:22 p.m. UTC
On Tue, Sep 27, 2016 at 03:08:07PM -0400, Jason Merrill wrote:
> On Tue, Sep 27, 2016 at 2:27 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> > This patch implements P0018R3.  Bootstrapped/regtested on x86_64-linux and
> > i686-linux, ok for trunk?
> 
> OK, thanks.

Apparently I forgot to add feature macro for this.
Tested on x86_64-linux, ok for trunk?

2016-09-27  Jakub Jelinek  <jakub@redhat.com>

	* c-cppbuiltin.c (c_cpp_builtins): Define __cpp_capture_star_this for
	-std=c++1z.

	* g++.dg/cpp1z/feat-cxx1z.C: Add __cpp_capture_star_this test.



	Jakub

Comments

Jason Merrill Sept. 27, 2016, 7:42 p.m. UTC | #1
OK, thanks.

On Tue, Sep 27, 2016 at 3:22 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> On Tue, Sep 27, 2016 at 03:08:07PM -0400, Jason Merrill wrote:
>> On Tue, Sep 27, 2016 at 2:27 PM, Jakub Jelinek <jakub@redhat.com> wrote:
>> > This patch implements P0018R3.  Bootstrapped/regtested on x86_64-linux and
>> > i686-linux, ok for trunk?
>>
>> OK, thanks.
>
> Apparently I forgot to add feature macro for this.
> Tested on x86_64-linux, ok for trunk?
>
> 2016-09-27  Jakub Jelinek  <jakub@redhat.com>
>
>         * c-cppbuiltin.c (c_cpp_builtins): Define __cpp_capture_star_this for
>         -std=c++1z.
>
>         * g++.dg/cpp1z/feat-cxx1z.C: Add __cpp_capture_star_this test.
>
> --- gcc/c-family/c-cppbuiltin.c.jj      2016-09-21 17:12:59.000000000 +0200
> +++ gcc/c-family/c-cppbuiltin.c 2016-09-27 21:15:39.518454348 +0200
> @@ -933,6 +933,7 @@ c_cpp_builtins (cpp_reader *pfile)
>           cpp_define (pfile, "__cpp_range_based_for=201603");
>           cpp_define (pfile, "__cpp_constexpr=201603");
>           cpp_define (pfile, "__cpp_if_constexpr=201606");
> +         cpp_define (pfile, "__cpp_capture_star_this=201603");
>         }
>        if (flag_concepts)
>         /* Use a value smaller than the 201507 specified in
> --- gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C.jj  2016-09-27 09:46:09.000000000 +0200
> +++ gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C     2016-09-27 21:16:50.447580459 +0200
> @@ -356,6 +356,12 @@
>  #  error "__cpp_aligned_new != 201606"
>  #endif
>
> +#ifndef __cpp_capture_star_this
> +#  error "__cpp_capture_star_this"
> +#elif __cpp_capture_star_this != 201603
> +#  error "__cpp_capture_star_this != 201603"
> +#endif
> +
>  #ifdef __has_cpp_attribute
>
>  #  if ! __has_cpp_attribute(maybe_unused)
>
>
>         Jakub
diff mbox

Patch

--- gcc/c-family/c-cppbuiltin.c.jj	2016-09-21 17:12:59.000000000 +0200
+++ gcc/c-family/c-cppbuiltin.c	2016-09-27 21:15:39.518454348 +0200
@@ -933,6 +933,7 @@  c_cpp_builtins (cpp_reader *pfile)
 	  cpp_define (pfile, "__cpp_range_based_for=201603");
 	  cpp_define (pfile, "__cpp_constexpr=201603");
 	  cpp_define (pfile, "__cpp_if_constexpr=201606");
+	  cpp_define (pfile, "__cpp_capture_star_this=201603");
 	}
       if (flag_concepts)
 	/* Use a value smaller than the 201507 specified in
--- gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C.jj	2016-09-27 09:46:09.000000000 +0200
+++ gcc/testsuite/g++.dg/cpp1z/feat-cxx1z.C	2016-09-27 21:16:50.447580459 +0200
@@ -356,6 +356,12 @@ 
 #  error "__cpp_aligned_new != 201606"
 #endif
 
+#ifndef __cpp_capture_star_this
+#  error "__cpp_capture_star_this"
+#elif __cpp_capture_star_this != 201603
+#  error "__cpp_capture_star_this != 201603"
+#endif
+
 #ifdef __has_cpp_attribute
 
 #  if ! __has_cpp_attribute(maybe_unused)