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.
This commit is contained in:
Patrick Palka 2020-09-28 11:54:57 -04:00
parent e189d5c931
commit 623443357e
2 changed files with 4 additions and 1 deletions

View File

@ -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;

View File

@ -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()
{