From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1984) id 5551139CF070; Fri, 17 Jul 2020 13:25:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5551139CF070 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1594992331; bh=Mgp5Vu+AThdtpZrGvN4e2kOE2tsWavXA2QsxE7DF6YQ=; h=From:To:Subject:Date:From; b=NJMOv3fYpGBiYOMJINLe+Jpjvs0mFBYu1IrembJORSMdzrlV9+HN2yAbmJQ+UOasM nv5qlpk4ncpo+4b7ufomeP5a7kmIoXwCzVbQNsDB9b+nFxxySvHZcxI29su1zugRp0 MApDvu3UbgVBP9NZ+LUyx2z8H1NwqKxvpk6A3B4M= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Tamar Christina To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/ARM/heads/arm-struct-reorg-wip)] libstdc++: Fix comment on __memcpyable X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/vendors/ARM/heads/arm-struct-reorg-wip X-Git-Oldrev: 0b0908c1f27d12a3cbbd3c9fd55aec1fe87586a6 X-Git-Newrev: 94f7d7ec6ebef49a50da777fd71db3d03ee03aa0 Message-Id: <20200717132531.5551139CF070@sourceware.org> Date: Fri, 17 Jul 2020 13:25:31 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jul 2020 13:25:31 -0000 https://gcc.gnu.org/g:94f7d7ec6ebef49a50da777fd71db3d03ee03aa0 commit 94f7d7ec6ebef49a50da777fd71db3d03ee03aa0 Author: Jonathan Wakely Date: Wed Mar 4 15:34:05 2020 +0000 libstdc++: Fix comment on __memcpyable The discussion of iterator_traits::value_type and the example with three tempalte arguments related to an earlier version of the patch, not the one committed. Also improve the comment on __memcmpable. * include/bits/cpp_type_traits.h (__memcpyable): Fix comment. Diff: --- libstdc++-v3/ChangeLog | 4 ++++ libstdc++-v3/include/bits/cpp_type_traits.h | 11 +++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ff8ae64d477..df3b040abca 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,7 @@ +2020-03-04 Jonathan Wakely + + * include/bits/cpp_type_traits.h (__memcpyable): Fix comment. + 2020-03-04 Patrick Palka PR libstdc++/94017 diff --git a/libstdc++-v3/include/bits/cpp_type_traits.h b/libstdc++-v3/include/bits/cpp_type_traits.h index fac6e4bbea2..979ad9c2c69 100644 --- a/libstdc++-v3/include/bits/cpp_type_traits.h +++ b/libstdc++-v3/include/bits/cpp_type_traits.h @@ -429,10 +429,9 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3) enum { __value = __is_trivially_copyable(_Tp) }; }; - // Cannot use memcpy/memmove/memcmp on volatile types, but before C++20 - // iterator_traits::value_type is volatile T and so the - // partial specializations below match for volatile-qualified pointers - // e.g. __memcpyable. + // Cannot use memcpy/memmove/memcmp on volatile types even if they are + // trivially copyable, so ensure __memcpyable + // and similar will be false. template struct __is_nonvolatile_trivially_copyable { @@ -457,6 +456,10 @@ __INT_N(__GLIBCXX_TYPE_INT_N_3) { }; // 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 struct __memcmpable {