+2020-03-04 Jonathan Wakely <jwakely@redhat.com>
+
+ * include/bits/cpp_type_traits.h (__memcpyable): Fix comment.
+
2020-03-04 Patrick Palka <ppalka@redhat.com>
PR libstdc++/94017
enum { __value = __is_trivially_copyable(_Tp) };
};
- // Cannot use memcpy/memmove/memcmp on volatile types, but before C++20
- // iterator_traits<volatile T*>::value_type is volatile T and so the
- // partial specializations below match for volatile-qualified pointers
- // e.g. __memcpyable<volatile int*, volatile int*, volatile int>.
+ // Cannot use memcpy/memmove/memcmp on volatile types even if they are
+ // trivially copyable, so ensure __memcpyable<volatile int*, volatile int*>
+ // and similar will be false.
template<typename _Tp>
struct __is_nonvolatile_trivially_copyable<volatile _Tp>
{
{ };
// Whether two iterator types can be used with memcmp.
+ // This trait only says it's well-formed to use memcmp, not that it
+ // gives the right answer for a given algorithm. So for example, std::equal
+ // needs to add additional checks that the types are integers or pointers,
+ // because other trivially copyable types can overload operator==.
template<typename _Iter1, typename _Iter2>
struct __memcmpable
{