constexpr bool is_const_v = is_const<_Tp>::value;
template <typename _Tp>
constexpr bool is_volatile_v = is_volatile<_Tp>::value;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template <typename _Tp>
constexpr bool is_trivial_v = is_trivial<_Tp>::value;
+#pragma GCC diagnostic pop
template <typename _Tp>
constexpr bool is_trivially_copyable_v = is_trivially_copyable<_Tp>::value;
template <typename _Tp>
: public true_type { };
#endif
- /// is_trivial
+ /** is_trivial
+ * @deprecated Deprecated in C++26.
+ * Use a combination of one or more more specialized type traits instead,
+ * such as `is_trivially_default_constructible`,
+ * `is_trivially_copy_constructible`, `is_trivially_copy_assignable`,
+ * etc., depending on the exact check(s) needed.
+ */
template<typename _Tp>
- struct is_trivial
+ struct
+ _GLIBCXX26_DEPRECATED_SUGGEST("is_trivially_default_constructible && is_trivially_copyable")
+ is_trivial
: public __bool_constant<__is_trivial(_Tp)>
{
static_assert(std::__is_complete_or_unbounded(__type_identity<_Tp>{}),
#endif
template <typename _Tp>
+ _GLIBCXX26_DEPRECATED_SUGGEST("is_trivially_default_constructible_v && is_trivially_copyable_v")
inline constexpr bool is_trivial_v = __is_trivial(_Tp);
template <typename _Tp>
inline constexpr bool is_trivially_copyable_v = __is_trivially_copyable(_Tp);
static_assert (std::is_pod<std::max_align_t>::value, "");
#endif
static_assert (std::is_standard_layout<std::max_align_t>::value, "");
+static_assert (std::is_trivially_copyable<std::max_align_t>::value, "");
+static_assert (std::is_trivially_default_constructible<std::max_align_t>::value, "");
+#if __cplusplus <= 202302L
static_assert (std::is_trivial<std::max_align_t>::value, "");
+#endif
namespace std
{
typedef short test_type;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
template struct is_trivial<test_type>;
+#pragma GCC diagnostic pop
}
void test01()
{
// Check for required typedefs
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
typedef std::is_trivial<int> test_type;
+#pragma GCC diagnostic pop
typedef test_type::value_type value_type;
typedef test_type::type type;
typedef test_type::type::value_type type_value_type;
using std::is_trivial;
using namespace __gnu_test;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
static_assert(test_category<is_trivial, TType>(true), "");
static_assert(test_category<is_trivial, PODType>(true), "");
static_assert(test_category<is_trivial, NType>(false), "");
static_assert(test_category<is_trivial, SLType>(false), "");
+#pragma GCC diagnostic pop
}
int i2;
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+// Deprecated in C++26
static_assert(is_trivial_v<int> && is_trivial<int>::value, "");
static_assert(!is_trivial_v<NType> && !is_trivial<NType>::value, "");
+#pragma GCC diagnostic pop
static_assert(is_trivially_copyable_v<int>
&& is_trivially_copyable<int>::value, "");
int i2;
};
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+// Deprecated in C++26
static_assert(is_trivial_v<int> && is_trivial<int>::value, "");
static_assert(!is_trivial_v<NType> && !is_trivial<NType>::value, "");
+#pragma GCC diagnostic pop
static_assert(is_trivially_copyable_v<int>
&& is_trivially_copyable<int>::value, "");