This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]