diff --git a/gsl/span b/gsl/span index 8803ef1..cce8253 100644 --- a/gsl/span +++ b/gsl/span @@ -123,23 +123,6 @@ namespace details { }; - template - struct is_allowed_pointer_conversion - : public std::integral_constant::value && - std::is_pointer::value && - std::is_convertible::value> - { - }; - - template - struct is_allowed_integral_conversion - : public std::integral_constant< - bool, std::is_integral::value && std::is_integral::value && - sizeof(From) == sizeof(To) && alignof(From) == alignof(To) && - std::is_convertible::value> - { - }; - template struct is_allowed_extent_conversion : public std::integral_constant struct is_allowed_element_type_conversion : public std::integral_constant>::value || - is_allowed_pointer_conversion::value || - is_allowed_integral_conversion::value> - { - }; - - template - struct is_allowed_element_type_conversion - : public std::integral_constant::value> - { - }; - - template - struct is_allowed_element_type_conversion : public std::true_type + std::is_convertible::value> { }; 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 s{arr}; CHECK(s.size() == narrow_cast(arr.size()) && s.data() == arr.data()); } + #ifdef CONFIRM_COMPILATION_ERRORS { span s{arr}; @@ -437,6 +438,7 @@ SUITE(span_tests) { span s{arr}; } +#endif { auto get_an_array = []() -> const std::array { 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 s{arr}; CHECK(s.size() == narrow_cast(arr.size()) && s.data() == arr.data()); } + #ifdef CONFIRM_COMPILATION_ERRORS { span s{arr}; @@ -509,7 +511,7 @@ SUITE(span_tests) { #ifdef CONFIRM_COMPILATION_ERRORS span s{cstr}; -#endif +#endif span cs{cstr}; CHECK(cs.size() == narrow_cast(cstr.size()) && cs.data() == cstr.data()); @@ -520,7 +522,7 @@ SUITE(span_tests) auto get_temp_vector = []() -> std::vector { return {}; }; auto use_span = [](span s) { static_cast(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 s) { static_cast(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 s) { static_cast(s); }; use_span(get_temp_string()); -#endif } { @@ -583,6 +583,7 @@ SUITE(span_tests) #endif } +#ifdef CONFIRM_COMPILATION_ERRORS { span s; span s2 = s; @@ -596,12 +597,11 @@ SUITE(span_tests) } { -#ifdef CONFIRM_COMPILATION_ERRORS span s; span s2 = s; static_cast(s2); -#endif } +#endif } TEST(copy_move_and_assignment) @@ -689,7 +689,7 @@ SUITE(span_tests) span av = arr; #ifdef CONFIRM_COMPILATION_ERRORS CHECK(av.last<6>().length() == 6); -#endif +#endif CHECK_THROW(av.last(6).length(), fail_fast); }