Skip to content

Conversation

@jaeheonshim
Copy link

Added DYNAMIC_NAMES type parameter to compile_format_string, which is set to true when runtime named arguments are present. Fixed missing named-arg validation by asserting that if DYNAMIC_NAMES is false, the arg_index produced by get_arg_index_by_name(arg_id_result.arg_id.name, Args{}) in the compile time parser must not be -1.

Also added a few tests under test/compile-error-test to verify intended behavior.

#4124

@jaeheonshim jaeheonshim force-pushed the fix-compile-arg-validation branch from 6bcf243 to 3c44f2d Compare December 30, 2025 01:47
Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Overall looks good, but please address the inline comments.

# Format string compilation tests
expect_compile(compiled-format-string-missing-argument-error "
#if defined(FMT_HAS_CONSTEVAL) && FMT_USE_NONTYPE_TEMPLATE_ARGS
using namespace fmt::literals;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unused both here and below.

FMT_END_NAMESPACE

#endif // FMT_COMPILE_H_
#endif // FMT_COMPILE_H_
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing newline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants