From a07411c2b9c440ce0879deeb05774b19bdc48dd2 Mon Sep 17 00:00:00 2001 From: Vladislav Shchapov Date: Thu, 25 Aug 2022 15:57:31 +0500 Subject: [PATCH] Disable compile-time checks for dynamic width/precision test for LCC and compiler without std::is_constant_evaluated() Signed-off-by: Vladislav Shchapov --- include/fmt/core.h | 3 +++ test/format-test.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/include/fmt/core.h b/include/fmt/core.h index 905b3613..86828332 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -755,8 +755,11 @@ class compile_parse_context using base::check_arg_id; FMT_CONSTEXPR void check_dynamic_spec(int arg_id) { + detail::ignore_unused(arg_id); +#if !defined(__LCC__) if (arg_id < num_args_ && types_ && !is_integral_type(types_[arg_id])) this->on_error("width/precision is not integer"); +#endif } }; FMT_END_DETAIL_NAMESPACE diff --git a/test/format-test.cc b/test/format-test.cc index f3bdb464..9d318470 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -2178,7 +2178,9 @@ TEST(format_test, format_string_errors) { EXPECT_ERROR("{: }", "format specifier requires signed argument", unsigned); EXPECT_ERROR("{:{}}", "argument not found", int); EXPECT_ERROR("{:.{}}", "argument not found", double); +# if defined(__cpp_lib_is_constant_evaluated) && !defined(__LCC__) EXPECT_ERROR("{:{}}", "width/precision is not integer", int, double); +# endif EXPECT_ERROR("{:.2}", "precision not allowed for this argument type", int); EXPECT_ERROR("{:s}", "invalid type specifier", int); EXPECT_ERROR("{:s}", "invalid type specifier", char);