2019-02-05 Jonathan Wakely <jwakely@redhat.com>
+ PR libstdc++/89194
+ * include/std/type_traits (__is_convertible_helper)
+ (__is_convertible_helper<_From, _To, false>): Revert changes to
+ support is_nothrow_convertible.
+ (__is_nt_convertible_helper): New helper.
+ (is_nothrow_convertible): Use __is_nt_convertible_helper.
+
* testsuite/23_containers/vector/modifiers/push_back/49836.cc: Restore
use of CopyConsOnlyType, but also test DelAnyAssign for completeness.
struct __is_convertible_helper
{
typedef typename is_void<_To>::type type;
-#if __cplusplus > 201703L
- typedef type __is_nothrow_type;
-#endif
};
template<typename _From, typename _To>
static false_type
__test(...);
-#if __cplusplus > 201703L
- template<typename _From1, typename _To1,
- bool _NoEx = noexcept(__test_aux<_To1>(std::declval<_From1>()))>
- static __bool_constant<_NoEx>
- __test_nothrow(int);
-
- template<typename, typename>
- static false_type
- __test_nothrow(...);
-#endif
-
public:
typedef decltype(__test<_From, _To>(0)) type;
-
-#if __cplusplus > 201703L
- typedef decltype(__test_nothrow<_From, _To>(0)) __is_nothrow_type;
-#endif
};
{ };
#if __cplusplus > 201703L
+ template<typename _From, typename _To,
+ bool = __or_<is_void<_From>, is_function<_To>,
+ is_array<_To>>::value>
+ struct __is_nt_convertible_helper
+ : is_void<_To>
+ { };
+
+ template<typename _From, typename _To>
+ class __is_nt_convertible_helper<_From, _To, false>
+ {
+ template<typename _To1>
+ static void __test_aux(_To1) noexcept;
+
+ template<typename _From1, typename _To1>
+ static bool_constant<noexcept(__test_aux<_To1>(std::declval<_From1>()))>
+ __test(int);
+
+ template<typename, typename>
+ static false_type
+ __test(...);
+
+ public:
+ using type = decltype(__test<_From, _To>(0));
+ };
+
/// is_nothrow_convertible
template<typename _From, typename _To>
struct is_nothrow_convertible
- : public __is_convertible_helper<_From, _To>::__is_nothrow_type
+ : public __is_nt_convertible_helper<_From, _To>::type
{ };
/// is_nothrow_convertible_v