diff --git a/test/sv_conversion_test.cpp b/test/sv_conversion_test.cpp index f9cec64e..50ea714a 100644 --- a/test/sv_conversion_test.cpp +++ b/test/sv_conversion_test.cpp @@ -29,6 +29,29 @@ boost::core::string_view f( boost::core::string_view const& str ) return str; } +template +boost::core::basic_string_view f( boost::core::basic_string_view const& str ) +{ + return str; +} + +template +void subtest() +{ + std::basic_string s1( 3, Char('1') ); + s1[1] = Char('2'); + s1[2] = Char('3'); + + std::basic_string s2 = f( s1 ); + BOOST_TEST( s1 == s2 ); + +#if ! (defined(BOOST_CLANG) && BOOST_CLANG_VERSION < 150000) + // leads to undefined symbols in Clang < 15: https://github.com/llvm/llvm-project/issues/55560 + std::basic_string s3( (f( s1 )) ); + BOOST_TEST( s1 == s3 ); +#endif +} + int main() { { @@ -62,5 +85,15 @@ int main() #endif +#if !defined(BOOST_NO_CXX11_CHAR16_T) + subtest(); +#endif +#if !defined(BOOST_NO_CXX11_CHAR32_T) + subtest(); +#endif +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L + subtest(); +#endif + return boost::report_errors(); }