https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116440
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
A simpler related testcase that we incorrectly reject in C++20 mode:
static_assert(std::is_constructible_v<std::any,
std::tuple<std::tuple<std::any>>>);
The errors look like:
.../include/tuple:911:34: error: the value of
‘std::is_constructible_v<std::any, std::tuple<std::tuple<std::any> > >’ is not
usable in a constant express
ion
911 | else if constexpr (is_constructible_v<_Tp, _Tuple>)
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../include/tuple:1014:51: error: ‘static consteval bool std::tuple<
<template-parameter-1-1> >::__use_other_ctor() [with _Tuple =
std::tuple<std::tuple<
std::any> >; _Elements = {std::any}]’ called in a constant expression
1014 | && (!__use_other_ctor<tuple<_UTypes...>>())
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
For whatever reason this is fixed by:
diff --git a/libstdc++-v3/include/std/tuple b/libstdc++-v3/include/std/tuple
index 34d790fd6f5..f971c527084 100644
--- a/libstdc++-v3/include/std/tuple
+++ b/libstdc++-v3/include/std/tuple
@@ -1011,7 +1011,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename... _UTypes>
requires (__constructible<_UTypes...>())
- && (!__use_other_ctor<tuple<_UTypes...>>())
+ && (!__use_other_ctor<tuple<_UTypes...>&&>())
&& (!__dangles<_UTypes...>())
constexpr explicit(!__convertible<_UTypes...>())
tuple(tuple<_UTypes...>&& __u)
@@ -1021,7 +1021,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename... _UTypes>
requires (__constructible<_UTypes...>())
- && (!__use_other_ctor<tuple<_UTypes...>>())
+ && (!__use_other_ctor<tuple<_UTypes...>&&>())
&& (__dangles<_UTypes...>())
tuple(tuple<_UTypes...>&&) = delete;
Doesn't help with the original testcase though.