diff --git a/include/fmt/compile.h b/include/fmt/compile.h index 64eb7a20dc81..78140a8dd673 100644 --- a/include/fmt/compile.h +++ b/include/fmt/compile.h @@ -416,7 +416,11 @@ constexpr auto compile_format_string(S fmt) { decltype(get_type::value), Args, arg_id_end_pos, arg_index, next_id>(fmt); } else if constexpr (c == '}') { - return parse_tail( + if constexpr (std::is_same_v>) { + static_assert(!std::is_same_v>, + "named argument referenced in format string but no arguments provided"); + } + return parse_tail( runtime_named_field{arg_id_result.arg_id.name}, fmt); } else if constexpr (c == ':') { return unknown_format(); // no type info for specs parsing