Re: C++ PATCH for P0135, C++17 guaranteed copy elision

2016-10-08 Thread Jason Merrill
On Thu, Oct 6, 2016 at 5:26 PM, Jason Merrill wrote: > Here's an update that handles more cases. And a further update that handles direct-initialization, which the actual proposal doesn't specify at all. I'm dealing with direct-initialization from a type with a conversion operator that produces

Re: C++ PATCH for P0135, C++17 guaranteed copy elision

2016-10-06 Thread Jason Merrill
Here's an update that handles more cases. commit 726447a210cf92a85e8f9d014b85d958a0af62b5 Author: Jason Merrill Date: Wed Oct 5 19:31:09 2016 -0400 C++17 copy elision improvements. * call.c (build_temp, convert_like_real): Don't re-copy TARGET_EXPR. Han

Re: C++ PATCH for P0135, C++17 guaranteed copy elision

2016-10-05 Thread Jason Merrill
On Wed, Oct 5, 2016 at 7:15 PM, Pedro Alves wrote: > On 10/05/2016 11:57 PM, Jason Merrill wrote: >> --- a/gcc/c-family/c-opts.c >> +++ b/gcc/c-family/c-opts.c >> @@ -1579,6 +1579,7 @@ set_std_cxx1z (int iso) >> + flag_elide_constructors = 2; Oops, that was an earlier version of the patch. Here

Re: C++ PATCH for P0135, C++17 guaranteed copy elision

2016-10-05 Thread Pedro Alves
On 10/05/2016 11:57 PM, Jason Merrill wrote: > --- a/gcc/c-family/c-opts.c > +++ b/gcc/c-family/c-opts.c > @@ -1579,6 +1579,7 @@ set_std_cxx1z (int iso) >flag_isoc94 = 1; >flag_isoc99 = 1; >flag_isoc11 = 1; > + flag_elide_constructors = 2; >cxx_dialect = cxx1z; >lang_hooks.name

C++ PATCH for P0135, C++17 guaranteed copy elision

2016-10-05 Thread Jason Merrill
C++17 changes how we describe prvalues so that they express initialization of an object to be named later, rather than objects themselves. This happens to match the front end's use of TARGET_EXPR pretty closely, so I think we don't need to do much more than disable the code that forces us to copy