[PATCH] PR libstdc++/78939 make tuple_size<cv T> depend on tuple_size<T>
Jonathan Wakely
jwakely@redhat.com
Fri May 12 15:53:00 GMT 2017
On 12/05/17 15:49 +0100, Jonathan Wakely wrote:
>This solves a conflict between late changes to the C++17 library and
>core language, which make tuple_size<const T>::value cause errors for
>const structured binding declarations. The problem is that LWG 2770
>wants tuple_size<cv T> to be complete, but sometimes have no value
>member, but the core language for structured bindings barfs on a
>complete type with no value member.
>
>It's possible this will be fixed in core (e.g. by only trying to use
>tuple_size when it's complete _and_ has a usable value member) but for
>now let's just fix it in the library. This is consistent with the
>solution in libc++ too.
>
> PR libstdc++/78939
> * include/std/utility (tuple_size<cv T>): Only define partial
> specializations when tuple_size<T>::value is valid.
> * testsuite/20_util/tuple/78939.cc: New.
> * testsuite/20_util/tuple/cv_tuple_size_neg.cc: New.
>
>Tested powerpc64le-linux, committed to trunk.
This is the patch for gcc-7-branch, which only uses the new
tuple_size<cv T> implementation for C++17 (because it's only needed to
make structured bindings work, and there's a chance this new
implementation could cause regressions for C++14 code).
Tested x86_64-linux, committed to gcc-7-branch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3199 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170512/aba98fb3/attachment.bin>
More information about the Libstdc++
mailing list