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]

[PATCH] PR libstdc++/78939 make tuple_size<cv T> depend on tuple_size<T>


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.

Attachment: patch.txt
Description: Text document


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