[PATCH] handle std::byte in -Wclass-memaccess (PR 94923)

Martin Sebor msebor@gmail.com
Fri May 8 18:16:42 GMT 2020


-Wclass-memaccess is suppressed for write accesses to trivially
copyable but otherwise nontrivial class types by character types
but the suppression neglects to consider the equivalent accesses
by std::byte.  The attached patch extends the same privilege also
to it.

I couldn't find a utility function to check if a type is one of
the four "special" byte types so I added one.  If there already
isn't one hiding somewhere and this type of a query is done in
other places maybe the function should be moved to cp-tree.h.

Rather than adding a new test I extended the existing one that
has all the infrastructure in place to comprehensively exercise
this (maybe even overly so).

Tested on x86_64-linux.

Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc-94923.diff
Type: text/x-patch
Size: 37489 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20200508/f8a795c7/attachment-0001.bin>


More information about the Gcc-patches mailing list