Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJordan Maples <jomaples@microsoft.com>2020-03-17 23:53:13 +0300
committerJordan Maples <jomaples@microsoft.com>2020-03-17 23:53:13 +0300
commit1dd1320c8b29099fe5bba591d1b0dba367fa68d7 (patch)
treefa44817dba4f8908e050b90fdc4f42cea9818d3a /tests
parentd90fefea6de716fdf5e90fe3cfd8281a704e3be2 (diff)
test commit to get extra eyes on the problem
Diffstat (limited to 'tests')
-rw-r--r--tests/span_compatibility_tests.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/span_compatibility_tests.cpp b/tests/span_compatibility_tests.cpp
index 8733e72..1985f6f 100644
--- a/tests/span_compatibility_tests.cpp
+++ b/tests/span_compatibility_tests.cpp
@@ -46,6 +46,22 @@ TEST(span_compatibility_tests, assertion_tests)
{
int arr[3]{10, 20, 30};
std::array<int, 3> stl{{100, 200, 300}};
+ std::array<int*, 3> stl_nullptr{{nullptr,nullptr,nullptr}};
+
+ {
+ gsl::span<const int* const> sp_const_nullptr_1{stl_nullptr};
+ EXPECT_TRUE(sp_const_nullptr_1.data() == stl_nullptr.data());
+ EXPECT_TRUE(sp_const_nullptr_1.size() == 3);
+
+#if __cplusplus >= 201703l
+ span<const int* const> sp_const_nullptr_2{std::as_const(stl_nullptr)};
+ EXPECT_TRUE(sp_const_nullptr_2.data() == stl_nullptr.data());
+ EXPECT_TRUE(sp_const_nullptr_2.size() == 3);
+
+ static_assert(std::is_same<decltype(span{stl_nullptr}), span<int*, 3>);
+ static_assert(std::is_same<decltype(span{std::as_const(stl_nullptr)}), span<int* const, 3>);
+#endif
+ }
{
gsl::span<int> sp_dyn;