Constrain explicit value and error constructors to not accept zero arguments. Fixes #86.

This commit is contained in:
Peter Dimov
2022-07-26 21:49:13 +03:00
parent ede243c42f
commit f2e1db8021

View File

@ -135,7 +135,8 @@ public:
template<class... A, class En = typename std::enable_if< template<class... A, class En = typename std::enable_if<
std::is_constructible<T, A...>::value && std::is_constructible<T, A...>::value &&
!(detail::is_errc_t<A...>::value && std::is_arithmetic<T>::value) && !(detail::is_errc_t<A...>::value && std::is_arithmetic<T>::value) &&
!std::is_constructible<E, A...>::value !std::is_constructible<E, A...>::value &&
sizeof...(A) >= 1
>::type> >::type>
explicit constexpr result( A&&... a ) explicit constexpr result( A&&... a )
noexcept( std::is_nothrow_constructible<T, A...>::value ) noexcept( std::is_nothrow_constructible<T, A...>::value )
@ -146,7 +147,8 @@ public:
// explicit, error // explicit, error
template<class... A, class En2 = void, class En = typename std::enable_if< template<class... A, class En2 = void, class En = typename std::enable_if<
!std::is_constructible<T, A...>::value && !std::is_constructible<T, A...>::value &&
std::is_constructible<E, A...>::value std::is_constructible<E, A...>::value &&
sizeof...(A) >= 1
>::type> >::type>
explicit constexpr result( A&&... a ) explicit constexpr result( A&&... a )
noexcept( std::is_nothrow_constructible<E, A...>::value ) noexcept( std::is_nothrow_constructible<E, A...>::value )