File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ constexpr auto ct_format = [](auto &&...args) {
221221
222222 using data = detail::fmt_data<Fmt>;
223223
224+ static_assert (data::N == sizeof ...(args),
225+ " Format string has a mismatch between the number of format "
226+ " specifiers and arguments." );
227+
224228 [[maybe_unused]] auto const format1 = [&]<std::size_t I>(auto &&arg) {
225229 constexpr auto cts =
226230 detail::to_ct_string<data::splits[I].size ()>(data::splits[I]);
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ if(${CMAKE_CXX_STANDARD} GREATER_EQUAL 20)
5959
6060 add_fail_tests (
6161 atomic_bool_dec
62+ ct_format_mismatch
6263 dynamic_span_no_ct_capacity
6364 dynamic_container_no_ct_capacity
6465 tuple_index_out_of_bounds
Original file line number Diff line number Diff line change 1+ #include < stdx/ct_format.hpp>
2+
3+ // EXPECT: mismatch between the number of format specifiers and arguments
4+
5+ auto main () -> int { [[maybe_unused]] auto x = stdx::ct_format<" Hello" >(42 ); }
You can’t perform that action at this time.
0 commit comments