File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,10 @@ constexpr auto ct_format = [](auto &&...args) {
221
221
222
222
using data = detail::fmt_data<Fmt>;
223
223
224
+ static_assert (data::N == sizeof ...(args),
225
+ " Format string has a mismatch between the number of format "
226
+ " specifiers and arguments." );
227
+
224
228
[[maybe_unused]] auto const format1 = [&]<std::size_t I>(auto &&arg) {
225
229
constexpr auto cts =
226
230
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)
59
59
60
60
add_fail_tests(
61
61
atomic_bool_dec
62
+ ct_format_mismatch
62
63
dynamic_span_no_ct_capacity
63
64
dynamic_container_no_ct_capacity
64
65
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