diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple index 34d790fd6f5..d3deb7bc124 100644 --- a/libstdc++-v3/include/std/tuple +++ b/libstdc++-v3/include/std/tuple @@ -966,12 +966,14 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _Inherited() { } - constexpr explicit(!__convertible()) - tuple(const _Elements&... __elements) - noexcept(__nothrow_constructible()) - requires (__constructible()) - : _Inherited(__elements...) - { } + // Defined as a template to work around PR libstdc++/116440. + template + constexpr explicit(!__convertible()) + tuple(const _Elements&... __elements) + noexcept(__nothrow_constructible()) + requires (__constructible()) + : _Inherited(__elements...) + { } template requires (__disambiguating_constraint<_UTypes...>()) diff --git a/libstdc++-v3/testsuite/20_util/tuple/116440.C b/libstdc++-v3/testsuite/20_util/tuple/116440.C new file mode 100644 index 00000000000..12259134d25 --- /dev/null +++ b/libstdc++-v3/testsuite/20_util/tuple/116440.C @@ -0,0 +1,29 @@ +// PR libstdc++/116440 - std::tuple> does not compile +// { dg-do compile { target c++17 } } + +#include +#include +#include + +template +using TupleTuple = std::tuple>; + +struct EmbedAny { + std::any content; +}; + +static_assert(std::is_copy_constructible>::value); +static_assert(std::is_move_constructible>::value); + +static_assert(std::is_copy_constructible>::value); +static_assert(std::is_move_constructible>::value); + +static_assert(std::is_constructible_v>); + +struct EmbedAnyWithZeroSizeArray { + void* pad[0]; + std::any content; +}; + +static_assert(std::is_copy_constructible>::value); +static_assert(std::is_move_constructible>::value);