aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPatrick Palka <ppalka@redhat.com>2024-04-02 13:07:07 -0400
committerPatrick Palka <ppalka@redhat.com>2024-04-02 13:07:07 -0400
commit0e64bbb8823f7b3757befc878ed177dfb59943d1 (patch)
tree1b7be5167af2481afc7f445b388ca4c42d959235 /gcc
parentd5aa2ca06aa7a6a2f826c4da19204b6db1402995 (diff)
downloadgcc-0e64bbb8823f7b3757befc878ed177dfb59943d1.zip
gcc-0e64bbb8823f7b3757befc878ed177dfb59943d1.tar.gz
gcc-0e64bbb8823f7b3757befc878ed177dfb59943d1.tar.bz2
libstdc++: Allow adjacent __maybe_present_t<false, ...> fields to overlap
Currently __maybe_present_t<false, T> maps to the same empty class type independent of T. This is suboptimal because it means adjacent __maybe_present_t<false, ...> members with the [[no_unique_address]] attribute can't overlap even if the conditionally present types are different. This patch turns this empty class type into a template parameterized by the conditionally present type, so that [[no_unique_address]] __maybe_present_t<false, T> _M_a; [[no_unique_address]] __maybe_present_t<false, U> _M_b; now overlap if T and U are different. This patch goes a step further and also adds an optional integer discriminator parameter to allow for overlapping when T and U are the same. libstdc++-v3/ChangeLog: * include/std/ranges (ranges::__detail::_Empty): Rename to ... (ranges::__detail::_Absent): ... this. Turn into a template parameterized by the absent type _Tp and discriminator _Disc. (ranges::__detail::__maybe_present_t): Add an optional discriminator parameter. (slide_view::_M_cached_begin): Pass a discriminator argument to __maybe_present_t. (slide_view::_M_cached_end): Likewise. * testsuite/std/ranges/adaptors/sizeof.cc: Verify the size of slide_view<V> is 3 instead 4 pointers. Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Diffstat (limited to 'gcc')
0 files changed, 0 insertions, 0 deletions