| 1 |
// PR 99283, |
| 2 |
// { dg-additional-options "-std=c++2a -fmodule-header" } |
| 3 |
// { dg-module-cmi {} } |
| 4 |
|
| 5 |
#include "pr99283-7-traits.h" |
| 6 |
|
| 7 |
template<class _CharT> |
| 8 |
struct char_traits; |
| 9 |
|
| 10 |
template<typename _CharT, typename _Traits = char_traits<_CharT>> |
| 11 |
class basic_string; |
| 12 |
|
| 13 |
typedef basic_string<char> string; |
| 14 |
|
| 15 |
template<typename _Tp, _Tp __v> |
| 16 |
struct integral_constant |
| 17 |
{ |
| 18 |
static constexpr _Tp value = __v; |
| 19 |
typedef _Tp value_type; |
| 20 |
typedef integral_constant<_Tp, __v> type; |
| 21 |
constexpr operator value_type() const noexcept { return value; } |
| 22 |
constexpr value_type operator()() const noexcept { return value; } |
| 23 |
}; |
| 24 |
|
| 25 |
template<typename _Tp, _Tp __v> |
| 26 |
constexpr _Tp integral_constant<_Tp, __v>::value; |
| 27 |
|
| 28 |
typedef integral_constant<bool, true> true_type; |
| 29 |
|
| 30 |
typedef integral_constant<bool, false> false_type; |
| 31 |
|
| 32 |
template<bool __v> |
| 33 |
using __bool_constant = integral_constant<bool, __v>; |
| 34 |
|
| 35 |
template<typename _Tp, typename _Up = _Tp&&> |
| 36 |
_Up __declval(int); |
| 37 |
|
| 38 |
template<typename _Tp> |
| 39 |
_Tp __declval(long); |
| 40 |
|
| 41 |
template<typename _Tp> |
| 42 |
auto declval() noexcept -> decltype(__declval<_Tp>(0)); |
| 43 |
|
| 44 |
struct __do_is_nothrow_swappable_impl |
| 45 |
{ |
| 46 |
template<typename _Tp> |
| 47 |
static __bool_constant< |
| 48 |
noexcept(swap(declval<_Tp&>(), declval<_Tp&>())) |
| 49 |
> __test(int); |
| 50 |
}; |
| 51 |
|
| 52 |
|
| 53 |
|
| 54 |
template<typename _Tp> |
| 55 |
struct __is_nothrow_swappable_impl |
| 56 |
: public __do_is_nothrow_swappable_impl |
| 57 |
{ |
| 58 |
typedef decltype(__test<_Tp>(0)) type; |
| 59 |
}; |
| 60 |
|
| 61 |
template<typename _Tp> |
| 62 |
struct __is_nothrow_swappable |
| 63 |
: public __is_nothrow_swappable_impl<_Tp>::type |
| 64 |
{ }; |
| 65 |
|
| 66 |
#include "pr99283-7-swap.h" |
| 67 |
|
| 68 |
class partial_ordering |
| 69 |
{ |
| 70 |
public: |
| 71 |
friend constexpr bool |
| 72 |
operator==(partial_ordering, partial_ordering) noexcept = default; |
| 73 |
}; |
| 74 |
|
| 75 |
class strong_ordering |
| 76 |
{ |
| 77 |
public: |
| 78 |
constexpr operator partial_ordering() const noexcept; |
| 79 |
}; |
| 80 |
|
| 81 |
template<typename _T1, typename _T2> |
| 82 |
struct pair |
| 83 |
{ |
| 84 |
constexpr void |
| 85 |
swap(pair& __p) |
| 86 |
noexcept(__is_nothrow_swappable<_T1>::value); |
| 87 |
}; |
| 88 |
|
| 89 |
template<typename _T1, typename _T2> |
| 90 |
inline constexpr bool |
| 91 |
operator==(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y); |
| 92 |
|
| 93 |
template<typename _CharT> |
| 94 |
struct char_traits |
| 95 |
{ |
| 96 |
using comparison_category = strong_ordering; |
| 97 |
}; |