aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNeil MacIntosh <neilmac@microsoft.com>2016-09-12 18:51:23 -0700
committerNeil MacIntosh <neilmac@microsoft.com>2016-09-12 18:51:23 -0700
commit3b2419532e8cdf78a4ba585f4dd15b9e08a4a48f (patch)
treee40270907817864a665818a7113baa97c662fa4f /tests
parentd23f4d931c98c074ebe90bebf609c397589bf7b9 (diff)
downloadplatform_external_Microsoft-GSL-3b2419532e8cdf78a4ba585f4dd15b9e08a4a48f.tar.gz
platform_external_Microsoft-GSL-3b2419532e8cdf78a4ba585f4dd15b9e08a4a48f.tar.bz2
platform_external_Microsoft-GSL-3b2419532e8cdf78a4ba585f4dd15b9e08a4a48f.zip
Corrected SFINAE for conversion constructors on span.
Diffstat (limited to 'tests')
-rw-r--r--tests/span_tests.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/span_tests.cpp b/tests/span_tests.cpp
index 571a821..a1dd64d 100644
--- a/tests/span_tests.cpp
+++ b/tests/span_tests.cpp
@@ -423,6 +423,7 @@ SUITE(span_tests)
span<const int, 4> s{arr};
CHECK(s.size() == narrow_cast<ptrdiff_t>(arr.size()) && s.data() == arr.data());
}
+
#ifdef CONFIRM_COMPILATION_ERRORS
{
span<const int, 2> s{arr};
@@ -437,6 +438,7 @@ SUITE(span_tests)
{
span<const int, 5> s{arr};
}
+#endif
{
auto get_an_array = []() -> const std::array<int, 4> { return {1, 2, 3, 4}; };
@@ -444,7 +446,6 @@ SUITE(span_tests)
// try to take a temporary std::array
take_a_span(get_an_array());
}
-#endif
}
TEST(from_std_array_const_constructor)
@@ -460,6 +461,7 @@ SUITE(span_tests)
span<const int, 4> s{arr};
CHECK(s.size() == narrow_cast<ptrdiff_t>(arr.size()) && s.data() == arr.data());
}
+
#ifdef CONFIRM_COMPILATION_ERRORS
{
span<const int, 2> s{arr};
@@ -509,7 +511,7 @@ SUITE(span_tests)
{
#ifdef CONFIRM_COMPILATION_ERRORS
span<char> s{cstr};
-#endif
+#endif
span<const char> cs{cstr};
CHECK(cs.size() == narrow_cast<std::ptrdiff_t>(cstr.size()) &&
cs.data() == cstr.data());
@@ -520,7 +522,7 @@ SUITE(span_tests)
auto get_temp_vector = []() -> std::vector<int> { return {}; };
auto use_span = [](span<int> s) { static_cast<void>(s); };
use_span(get_temp_vector());
-#endif
+#endif
}
{
@@ -534,7 +536,7 @@ SUITE(span_tests)
auto get_temp_string = []() -> std::string { return{}; };
auto use_span = [](span<char> s) { static_cast<void>(s); };
use_span(get_temp_string());
-#endif
+#endif
}
{
@@ -552,11 +554,9 @@ SUITE(span_tests)
}
{
-#ifdef CONFIRM_COMPILATION_ERRORS
auto get_temp_string = []() -> const std::string { return {}; };
auto use_span = [](span<const char> s) { static_cast<void>(s); };
use_span(get_temp_string());
-#endif
}
{
@@ -583,6 +583,7 @@ SUITE(span_tests)
#endif
}
+#ifdef CONFIRM_COMPILATION_ERRORS
{
span<int> s;
span<unsigned int> s2 = s;
@@ -596,12 +597,11 @@ SUITE(span_tests)
}
{
-#ifdef CONFIRM_COMPILATION_ERRORS
span<int> s;
span<short> s2 = s;
static_cast<void>(s2);
-#endif
}
+#endif
}
TEST(copy_move_and_assignment)
@@ -689,7 +689,7 @@ SUITE(span_tests)
span<int, 5> av = arr;
#ifdef CONFIRM_COMPILATION_ERRORS
CHECK(av.last<6>().length() == 6);
-#endif
+#endif
CHECK_THROW(av.last(6).length(), fail_fast);
}