// -*- C++ -*- //===------------------------------ span ---------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===---------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14, c++17 // // template // constexpr span(const span& s) noexcept; // // Remarks: This constructor shall not participate in overload resolution unless: // Extent == dynamic_extent || Extent == OtherExtent is true, and // OtherElementType(*)[] is convertible to ElementType(*)[]. #include #include #include #include "test_macros.h" void checkCV () { // std::span< int> sp; std::span csp; std::span< volatile int> vsp; std::span cvsp; // std::span< int, 0> sp0; std::span csp0; std::span< volatile int, 0> vsp0; std::span cvsp0; // Try to remove const and/or volatile (dynamic -> dynamic) { std::span< int> s1{ csp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int> s2{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s4{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s5{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int> s6{ csp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int> s7{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} } // Try to remove const and/or volatile (static -> static) { std::span< int, 0> s1{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int, 0> s2{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int, 0> s3{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s4{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s5{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int, 0> s6{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int, 0> s7{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} } // Try to remove const and/or volatile (static -> dynamic) { std::span< int> s1{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int> s2{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int> s3{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s4{ vsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s5{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int> s6{ csp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int> s7{cvsp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} } // Try to remove const and/or volatile (static -> static) { std::span< int, 0> s1{ csp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int, 0> s2{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< int, 0> s3{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s4{ vsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s5{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int, 0> s6{ csp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span< volatile int, 0> s7{cvsp}; // expected-error {{no matching constructor for initialization of 'std::span'}} } } int main () { std::span sp; std::span sp0; std::span s1{sp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s2{sp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s3{sp}; // expected-error {{no matching constructor for initialization of 'std::span'}} std::span s4{sp0}; // expected-error {{no matching constructor for initialization of 'std::span'}} checkCV(); }