diff --git a/libcxx/docs/UsingLibcxx.rst b/libcxx/docs/UsingLibcxx.rst --- a/libcxx/docs/UsingLibcxx.rst +++ b/libcxx/docs/UsingLibcxx.rst @@ -380,18 +380,30 @@ * ``adjacent_find`` * ``all_of`` * ``any_of`` +* ``as_const`` * ``binary_search`` +* ``bit_cast`` +* ``cbrt`` +* ``ceil`` * ``clamp`` +* ``copysign`` * ``count_if`` * ``count`` * ``equal_range`` * ``equal`` +* ``fabs`` * ``find_end`` * ``find_first_of`` * ``find_if_not`` * ``find_if`` * ``find`` +* ``floor`` +* ``fmax`` +* ``fmin`` +* ``forward`` +* ``fpclassify`` * ``get_temporary_buffer`` +* ``identity::operator()`` * ``includes`` * ``is_heap_until`` * ``is_heap`` @@ -399,8 +411,21 @@ * ``is_permutation`` * ``is_sorted_until`` * ``is_sorted`` +* ``isfinite`` +* ``isgreater`` +* ``isgreaterequal`` +* ``isinf`` +* ``isless`` +* ``islessequal`` +* ``islessgreater`` +* ``isnan`` +* ``isnormal`` +* ``isunordered`` * ``lexicographical_compare`` +* ``lock_guard``'s constructors * ``lower_bound`` +* ``make_format_args`` +* ``make_wformat_args`` * ``max_element`` * ``max`` * ``min_element`` @@ -408,13 +433,10 @@ * ``minmax_element`` * ``minmax`` * ``mismatch`` +* ``move_if_noexcept`` +* ``move`` +* ``nearbyint`` * ``none_of`` -* ``remove_if`` -* ``remove`` -* ``search_n`` -* ``search`` -* ``unique`` -* ``upper_bound`` * ``ranges::adjacent_find`` * ``ranges::all_of`` * ``ranges::any_of`` @@ -453,38 +475,19 @@ * ``ranges::search`` * ``ranges::unique`` * ``ranges::upper_bound`` -* ``lock_guard``'s constructors -* ``as_const`` -* ``bit_cast`` -* ``forward`` -* ``move`` -* ``move_if_noexcept`` -* ``identity::operator()`` -* ``to_integer`` -* ``to_underlying`` -* ``signbit`` -* ``fpclassify`` -* ``isfinite`` -* ``isinf`` -* ``isnan`` -* ``isnormal`` -* ``isgreater`` -* ``isgreaterequal`` -* ``isless`` -* ``islessequal`` -* ``islessgreater`` -* ``isunordered`` -* ``ceil`` -* ``fabs`` -* ``floor`` -* ``cbrt`` -* ``copysign`` -* ``fmax`` -* ``fmin`` -* ``nearbyint`` +* ``remove_if`` +* ``remove`` * ``rint`` * ``round`` +* ``search_n`` +* ``search`` +* ``signbit`` +* ``to_integer`` +* ``to_underlying`` * ``trunc`` +* ``unique`` +* ``upper_bound`` +* ``vformat`` Extended integral type support ------------------------------ diff --git a/libcxx/include/__format/format_functions.h b/libcxx/include/__format/format_functions.h --- a/libcxx/include/__format/format_functions.h +++ b/libcxx/include/__format/format_functions.h @@ -65,16 +65,17 @@ #endif template -_LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&&... __args) { +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store<_Context, _Args...> make_format_args(_Args&&... __args) { return _VSTD::__format_arg_store<_Context, _Args...>(__args...); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template -_LIBCPP_HIDE_FROM_ABI __format_arg_store make_wformat_args(_Args&&... __args) { +_LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI __format_arg_store +make_wformat_args(_Args&&... __args) { return _VSTD::__format_arg_store(__args...); } -#endif +# endif namespace __format { @@ -442,38 +443,38 @@ // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup // fires too eagerly, see http://llvm.org/PR61563. template -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); return __res; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup // fires too eagerly, see http://llvm.org/PR61563. template -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring vformat(wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), __fmt, __args); return __res; } -#endif +# endif template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string format(format_string<_Args...> __fmt, - _Args&&... __args) { +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string +format(format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(__fmt.get(), _VSTD::make_format_args(__args...)); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring format(wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(__fmt.get(), _VSTD::make_wformat_args(__args...)); } -#endif +# endif template _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, @@ -509,20 +510,20 @@ } template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(__fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); } -#endif +# endif -#ifndef _LIBCPP_HAS_NO_LOCALIZATION +# ifndef _LIBCPP_HAS_NO_LOCALIZATION template requires(output_iterator<_OutIt, const _CharT&>) _LIBCPP_HIDE_FROM_ABI _OutIt @@ -577,7 +578,7 @@ // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup // fires too eagerly, see http://llvm.org/PR61563. template -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI string vformat(locale __loc, string_view __fmt, format_args __args) { string __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, @@ -585,35 +586,34 @@ return __res; } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS // TODO FMT This needs to be a template or std::to_chars(floating-point) availability markup // fires too eagerly, see http://llvm.org/PR61563. template -_LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE inline _LIBCPP_HIDE_FROM_ABI wstring vformat(locale __loc, wstring_view __fmt, wformat_args __args) { wstring __res; _VSTD::vformat_to(_VSTD::back_inserter(__res), _VSTD::move(__loc), __fmt, __args); return __res; } -#endif +# endif template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string format(locale __loc, - format_string<_Args...> __fmt, - _Args&&... __args) { +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI string +format(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), _VSTD::make_format_args(__args...)); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI wstring format(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::vformat(_VSTD::move(__loc), __fmt.get(), _VSTD::make_wformat_args(__args...)); } -#endif +# endif template _LIBCPP_HIDE_FROM_ABI format_to_n_result<_OutIt> __vformat_to_n(_OutIt __out_it, iter_difference_t<_OutIt> __n, @@ -654,21 +654,20 @@ } template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, format_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_format_args(__args...)}); } -#ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS +# ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS template -_LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t +_LIBCPP_NODISCARD_EXT _LIBCPP_ALWAYS_INLINE _LIBCPP_HIDE_FROM_ABI size_t formatted_size(locale __loc, wformat_string<_Args...> __fmt, _Args&&... __args) { return _VSTD::__vformatted_size(_VSTD::move(__loc), __fmt.get(), basic_format_args{_VSTD::make_wformat_args(__args...)}); } -#endif - -#endif // _LIBCPP_HAS_NO_LOCALIZATION +# endif +# endif // _LIBCPP_HAS_NO_LOCALIZATION #endif //_LIBCPP_STD_VER >= 20 diff --git a/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp b/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp new file mode 100644 --- /dev/null +++ b/libcxx/test/libcxx/diagnostics/format.nodiscard_extensions.compile.pass.cpp @@ -0,0 +1,50 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Check that format functions aren't marked [[nodiscard]] when +// _LIBCPP_DISBALE_NODISCARD_EXT is defined + +// TODO FMT This test should not require std::to_chars(floating-point) +// XFAIL: availability-fp_to_chars-missing + +// UNSUPPORTED: c++03, c++11, c++14 ,c++17 + +// ADDITIONAL_COMPILE_FLAGS: -D_LIBCPP_DISABLE_NODISCARD_EXT + +#include + +#include "test_macros.h" + +#ifndef TEST_HAS_NO_LOCALIZATION +# include +#endif + +void test() { + std::format(""); + std::vformat("", std::make_format_args()); + std::formatted_size(""); + std::make_format_args(); + +#ifndef TEST_HAS_NO_WIDE_CHARACTERS + std::format(L""); + std::vformat(L"", std::make_wformat_args()); + std::formatted_size(L""); + std::make_wformat_args(); +#endif // TEST_HAS_NO_WIDE_CHARACTERS + +#ifndef TEST_HAS_NO_LOCALIZATION + std::format(std::locale::classic(), ""); + std::vformat(std::locale::classic(), "", std::make_format_args()); + std::formatted_size(std::locale::classic(), ""); +# ifndef TEST_HAS_NO_WIDE_CHARACTERS + std::format(std::locale::classic(), L""); + std::vformat(std::locale::classic(), L"", std::make_wformat_args()); + std::formatted_size(std::locale::classic(), L""); +# endif // TEST_HAS_NO_WIDE_CHARACTERS +#endif // TEST_HAS_NO_LOCALIZATION +} diff --git a/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp b/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp --- a/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp +++ b/libcxx/test/std/utilities/format/format.arguments/format.arg.store/make_format_args.sh.cpp @@ -21,7 +21,9 @@ #include #include +#include "test_macros.h" + void test() { - std::make_format_args>, wchar_t>>('c'); + TEST_IGNORE_NODISCARD + std::make_format_args>, wchar_t>>('c'); } diff --git a/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.locale.verify.cpp @@ -28,65 +28,65 @@ // clang-format off void f() { - std::format(std::locale(), "{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), "{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), "{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(std::locale(), L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(std::locale(), L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(std::locale(), L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif } diff --git a/libcxx/test/std/utilities/format/format.functions/format.verify.cpp b/libcxx/test/std/utilities/format/format.functions/format.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/format.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/format.verify.cpp @@ -26,65 +26,65 @@ // clang-format off void f() { - std::format("{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif } @@ -96,9 +96,9 @@ void P2418() { auto t = tiny{}; - std::format("{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}} + TEST_IGNORE_NODISCARD std::format("{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(L"{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}} + TEST_IGNORE_NODISCARD std::format(L"{}", t.bit); // expected-error{{non-const reference cannot bind to bit-field 'bit'}} #endif } diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp b/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.locale.verify.cpp @@ -30,65 +30,65 @@ // clang-format off void f() { - std::formatted_size(std::locale(), "{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), "{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), "{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::formatted_size(std::locale(), L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(std::locale(), L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(std::locale(), L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif } diff --git a/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp b/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp --- a/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp +++ b/libcxx/test/std/utilities/format/format.functions/formatted_size.verify.cpp @@ -26,65 +26,65 @@ // clang-format off void f() { - std::formatted_size("{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{:-}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{:#}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{:L}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{0:{0}}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{:.42d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size("{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size("{:d}", "Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::formatted_size(L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{0}"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{:-}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{:#}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{:L}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{0:{0}}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{:.42d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::formatted_size(L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::formatted_size(L"{:d}", L"Forty-two"); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif } diff --git a/libcxx/test/std/utilities/format/format.tuple/format.functions.format.verify.cpp b/libcxx/test/std/utilities/format/format.tuple/format.functions.format.verify.cpp --- a/libcxx/test/std/utilities/format/format.tuple/format.functions.format.verify.cpp +++ b/libcxx/test/std/utilities/format/format.tuple/format.functions.format.verify.cpp @@ -20,34 +20,34 @@ // clang-format off void f() { - std::format("{::}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{::}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{::^}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{::^}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:+}", std::make_pair(0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:+}", std::make_pair(0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:m}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:m}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format("{:m}", std::make_tuple(0, 0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format("{:m}", std::make_tuple(0, 0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #ifndef TEST_HAS_NO_WIDE_CHARACTERS - std::format(L"{::}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{::}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{::^}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{::^}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:+}", std::make_pair(0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:+}", std::make_pair(0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:m}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:m}", std::make_tuple(0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} - std::format(L"{:m}", std::make_tuple(0, 0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} + TEST_IGNORE_NODISCARD std::format(L"{:m}", std::make_tuple(0, 0, 0)); // expected-error-re{{call to consteval function '{{.*}}' is not a constant expression}} // expected-note@*:* {{non-constexpr function '__throw_format_error' cannot be used in a constant expression}} #endif }