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: [v3 PATCH] Constrain optional's __constexpr_addressof in its return type, Use a constexpr addressof for optional, if available.


On 06/12/16 10:52 +0200, Ville Voutilainen wrote:
The background for these is at
https://stackoverflow.com/questions/40983822/cannot-use-a-constant-reference-of-experimentaloptional-when-using-clang-lib

We use excessive trickery to constrain __constexpr_addressof in
experimental::optional.
That trickery is not agreed on by compilers, and we can cope with a much simpler
approach.

The first patch just simplifies that trickery by moving the
constraints from a template
parameter to the return type.

The second patch uses a constexpr std::__addressof if it's available.
I split these
out in case we want just the first patch but not the second. The second patch
allows C++17 users to benefit from a completely constexpr addressof even
for experimental::optional (std::optional already gives that).

Tested on Linux-x64. Ok for trunk, the gcc-6 branch and the gcc-5 branch?

Yes, both patches are OK for all branches (they only affect
experimental TS material and/or C++17 mode, so OK for stage 3).

Thanks.



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