diff options
author | Jonathan Wakely <jwakely@redhat.com> | 2019-12-05 13:50:08 +0000 |
---|---|---|
committer | Jonathan Wakely <redi@gcc.gnu.org> | 2019-12-05 13:50:08 +0000 |
commit | 5a784d350c57d670775471bec847370ed7677666 (patch) | |
tree | 6fff962fc5ffc046b9deaeae78bb11a68c8157e2 /libstdc++-v3 | |
parent | a7922ddf481b048c0aaa5fae9d836d656e08d850 (diff) |
libstdc++: Fix bug in std::span test
The previous commit fixed the std::span constructors from const arrays,
revealing a bug in this test.
* testsuite/23_containers/span/lwg3255.cc: Fix test. Constructing a
span of non-const elements should not be possible from a const array
or an array of const elements.
From-SVN: r279001
Diffstat (limited to 'libstdc++-v3')
-rw-r--r-- | libstdc++-v3/ChangeLog | 6 | ||||
-rw-r--r-- | libstdc++-v3/testsuite/23_containers/span/lwg3255.cc | 9 |
2 files changed, 13 insertions, 2 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 82cb5a99400..b041bb4e3ed 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2019-12-05 Jonathan Wakely <jwakely@redhat.com> + + * testsuite/23_containers/span/lwg3255.cc: Fix test. Constructing a + span of non-const elements should not be possible from a const array + or an array of const elements. + 2019-12-05 JeanHeyd "ThePhD" Meneide <phdofthehouse@gmail.com> Implement P1872R0 and P1394R0 for std::span diff --git a/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc b/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc index bab7da3bf19..eec686b4ea2 100644 --- a/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc +++ b/libstdc++-v3/testsuite/23_containers/span/lwg3255.cc @@ -39,7 +39,6 @@ static_assert( is_constructible_v<span<int, 1>, array<int, 1>&> ); static_assert( is_constructible_v<span<const int, 1>, array<int, 1>&> ); static_assert( is_constructible_v<span<const int, 1>, array<const int, 1>&> ); -static_assert( is_constructible_v<span<int, 1>, const array<int, 1>&> ); static_assert( is_constructible_v<span<const int, 1>, const array<int, 1>&> ); static_assert( is_constructible_v<span<const int, 1>, const array<const int, 1>&> ); @@ -63,6 +62,12 @@ static_assert( is_constructible_v<span<int>, array<int, 2>&> ); static_assert( is_constructible_v<span<const int>, array<int, 2>&> ); static_assert( is_constructible_v<span<const int>, array<const int, 2>&> ); -static_assert( is_constructible_v<span<int>, const array<int, 2>&> ); static_assert( is_constructible_v<span<const int>, const array<int, 2>&> ); static_assert( is_constructible_v<span<const int>, const array<const int, 2>&> ); + +static_assert( ! is_constructible_v<span<int, 1>, array<const int, 1>&> ); +static_assert( ! is_constructible_v<span<int, 1>, const array<int, 1>&> ); +static_assert( ! is_constructible_v<span<int, 1>, const array<const int, 1>&> ); +static_assert( ! is_constructible_v<span<int>, array<const int, 2>&> ); +static_assert( ! is_constructible_v<span<int>, const array<int, 2>&> ); +static_assert( ! is_constructible_v<span<int>, const array<const int, 2>&> ); |