mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-22 10:30:05 +00:00
enable named arguments check in compile-time checks (#2649)
works only if all named arguments are UDL-based
This commit is contained in:
parent
82246b8766
commit
ef72b471fc
@ -1109,6 +1109,11 @@ template <typename... Args> constexpr auto count_named_args() -> size_t {
|
||||
return count<is_named_arg<Args>::value...>();
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
constexpr auto count_statically_named_args() -> size_t {
|
||||
return count<is_statically_named_arg<Args>::value...>();
|
||||
}
|
||||
|
||||
enum class type {
|
||||
none_type,
|
||||
// Integer types should go first,
|
||||
@ -3043,7 +3048,8 @@ template <typename Char, typename... Args> class basic_format_string {
|
||||
std::is_reference<Args>::value)...>() == 0,
|
||||
"passing views as lvalues is disallowed");
|
||||
#ifdef FMT_HAS_CONSTEVAL
|
||||
if constexpr (detail::count_named_args<Args...>() == 0) {
|
||||
if constexpr (detail::count_named_args<Args...>() ==
|
||||
detail::count_statically_named_args<Args...>()) {
|
||||
using checker = detail::format_string_checker<Char, detail::error_handler,
|
||||
remove_cvref_t<Args>...>;
|
||||
detail::parse_format_string<true>(str_, checker(s, {}));
|
||||
|
Loading…
Reference in New Issue
Block a user