libstdc++: Fix redefinition error in std::tuple [PR108822]
When using a compiler that doesn't define __cpp_conditional_explicit there's a redefinition error for tuple::__nothrow_assignable. This is because it's defined in different places for the pre-C++20 and C++20 implementations, which are controled by different preprocessor conditions. For certain combinations of C++20 feature test macros it's possible for both __nothrow_assignable definitions to be in scope. Move the pre-C++20 __assignable and __nothrow_assignable definitions adjacent to their use, so that only one set of definitions is visible for any given set of feature test macros. libstdc++-v3/ChangeLog: PR libstdc++/108822 * include/std/tuple (__assignable, __is_nothrow_assignable): Move pre-C++20 definitions adjacent to their use.
This commit is contained in:
parent
6c703b4eb6
commit
1e88a151f8
1 changed files with 19 additions and 16 deletions
|
@ -1237,20 +1237,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
_TCC<_Cond>::template __is_explicitly_constructible<_Args...>(),
|
||||
bool>;
|
||||
|
||||
template<typename... _UElements>
|
||||
static constexpr
|
||||
__enable_if_t<sizeof...(_UElements) == sizeof...(_Elements), bool>
|
||||
__assignable()
|
||||
{ return __and_<is_assignable<_Elements&, _UElements>...>::value; }
|
||||
|
||||
// Condition for noexcept-specifier of an assignment operator.
|
||||
template<typename... _UElements>
|
||||
static constexpr bool __nothrow_assignable()
|
||||
{
|
||||
return
|
||||
__and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
|
||||
}
|
||||
|
||||
// Condition for noexcept-specifier of a constructor.
|
||||
template<typename... _UElements>
|
||||
static constexpr bool __nothrow_constructible()
|
||||
|
@ -1685,7 +1671,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
operator=(_UTuple&& __u) const;
|
||||
#endif // C++23
|
||||
|
||||
#else // ! concepts
|
||||
#else // ! (concepts && consteval)
|
||||
|
||||
private:
|
||||
template<typename... _UElements>
|
||||
static constexpr
|
||||
__enable_if_t<sizeof...(_UElements) == sizeof...(_Elements), bool>
|
||||
__assignable()
|
||||
{ return __and_<is_assignable<_Elements&, _UElements>...>::value; }
|
||||
|
||||
// Condition for noexcept-specifier of an assignment operator.
|
||||
template<typename... _UElements>
|
||||
static constexpr bool __nothrow_assignable()
|
||||
{
|
||||
return
|
||||
__and_<is_nothrow_assignable<_Elements&, _UElements>...>::value;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
_GLIBCXX20_CONSTEXPR
|
||||
tuple&
|
||||
|
@ -1728,7 +1731,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
|||
this->_M_assign(std::move(__in));
|
||||
return *this;
|
||||
}
|
||||
#endif // concepts
|
||||
#endif // concepts && consteval
|
||||
|
||||
// tuple swap
|
||||
_GLIBCXX20_CONSTEXPR
|
||||
|
|
Loading…
Add table
Reference in a new issue