c++: Not all character types are byte-access types.
authorJason Merrill <jason@redhat.com>
Thu, 29 Oct 2020 20:50:57 +0000 (16:50 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 3 Nov 2020 22:15:30 +0000 (17:15 -0500)
commite7144372e06bf446d1bfb529806a803467ba697a
tree0b52c7ad96e460585ceec29d73331743803396d8
parente1276e334298251d73303999d2adc688abbfc856
c++: Not all character types are byte-access types.

The patch for 94923 that introduced is_byte_access_type wrongly changed
build_cplus_array_type to treat even arrays of char16_t as typeless storage,
which is wrong; only arrays of char and unsigned char have the special alias
semantics in C++.

G++ used to treat signed char the same way, as C does, but C++ has always
omitted it.

gcc/cp/ChangeLog:

* tree.c (is_byte_access_type): Don't use char_type_p.

gcc/testsuite/ChangeLog:

* g++.dg/Wclass-memaccess.C: Check that signed char and
char16_t aren't treated as byte-access types.
gcc/cp/tree.c
gcc/testsuite/g++.dg/Wclass-memaccess.C