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,23 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#include "test_macros.h" + +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