diff --git a/libcxx/include/string b/libcxx/include/string --- a/libcxx/include/string +++ b/libcxx/include/string @@ -4736,7 +4736,7 @@ #ifndef _LIBCPP_HAS_NO_CHAR8_T inline _LIBCPP_HIDE_FROM_ABI constexpr - basic_string operator "" s(const char8_t *__str, size_t __len) _NOEXCEPT + basic_string operator "" s(const char8_t *__str, size_t __len) { return basic_string (__str, __len); } diff --git a/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp b/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/std/strings/basic.string.literals/noexcept.compile.pass.cpp @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++03, c++11 + +#include + +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#ifndef TEST_HAS_NO_CHAR8_T +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#endif +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#ifndef TEST_HAS_NO_WIDE_CHARACTERS +static_assert(!noexcept(std::operator""s(std::declval(), std::declval()))); +#endif diff --git a/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp b/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp --- a/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp +++ b/libcxx/test/std/strings/string.classes/typedefs.compile.pass.cpp @@ -26,7 +26,7 @@ #ifndef TEST_HAS_NO_WIDE_CHARACTERS static_assert((std::is_same >::value), ""); #endif -#if defined(__cpp_lib_char8_t) && __cpp_lib_char8_t >= 201811L +#ifndef TEST_HAS_NO_CHAR8_T static_assert((std::is_same >::value), ""); #endif static_assert((std::is_same >::value), "");