[PATCH] libstdc++: Remove overzealous static_asserts from std::span

Jonathan Wakely jwakely@redhat.com
Mon Sep 21 21:17:30 GMT 2020


On 21/09/20 15:07 -0400, Patrick Palka via Libstdc++ wrote:
>On Mon, 21 Sep 2020, Patrick Palka wrote:
>
>> For a span with empty static extent, we currently model the
>> preconditions of front(), back(), and operator[] as if they were
>> mandates, by using a static_assert to verify that extent != 0.  This
>> causes us to incorrectly reject valid programs that instantiate these
>> member functions but never call them.
>>
>> libstdc++-v3/ChangeLog:
>>
>> 	* include/std/span (span::front): Remove static_assert.
>> 	(span::back): Likewise.
>> 	(span::operator[]): Likewise.
>> 	* testsuite/23_containers/span/back_neg.cc: Remove.
>> 	* testsuite/23_containers/span/front_neg.cc: Remove.
>> 	* testsuite/23_containers/span/index_op_neg.cc: Remove.
>
>Here's a version that rewrites rather than removes the testcases:

OK fortrunk, thanks.

We might want to backport this too.




More information about the Gcc-patches mailing list