public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-3501] libstdc++: Reduce the size of an unbounded iota_view Date: Mon, 28 Sep 2020 16:05:53 +0000 (GMT) [thread overview] Message-ID: <20200928160553.AD880386F81D@sourceware.org> (raw) https://gcc.gnu.org/g:623443357e6092067b4cf98cc6c0aeff7560b98d commit r11-3501-g623443357e6092067b4cf98cc6c0aeff7560b98d Author: Patrick Palka <ppalka@redhat.com> Date: Mon Sep 28 11:54:57 2020 -0400 libstdc++: Reduce the size of an unbounded iota_view libstdc++-v3/ChangeLog: * include/std/ranges (iota_view::_M_bound): Give it [[no_unique_address]]. * testsuite/std/ranges/iota/iota_view.cc: Check that an unbounded iota_view has minimal size. Diff: --- libstdc++-v3/include/std/ranges | 2 +- libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index ed04fa0001d..964a2b616a6 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -511,7 +511,7 @@ namespace ranges }; _Winc _M_value = _Winc(); - _Bound _M_bound = _Bound(); + [[no_unique_address]] _Bound _M_bound = _Bound(); public: iota_view() = default; diff --git a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc index 65d166fbd3b..8a33e10a093 100644 --- a/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc +++ b/libstdc++-v3/testsuite/std/ranges/iota/iota_view.cc @@ -77,6 +77,9 @@ test04() VERIFY( it == v.end() ); } +// Verify we optimize away the 'bound' data member of an unbounded iota_view. +static_assert(sizeof(std::ranges::iota_view<char>) == 1); + int main() {
reply other threads:[~2020-09-28 16:05 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200928160553.AD880386F81D@sourceware.org \ --to=ppalka@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ --cc=libstdc++-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).