Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated named arguments are ignored, but not rejected #4282

Open
lewkok opened this issue Jan 1, 2025 · 1 comment
Open

Duplicated named arguments are ignored, but not rejected #4282

lewkok opened this issue Jan 1, 2025 · 1 comment

Comments

@lewkok
Copy link

lewkok commented Jan 1, 2025

Hi,
Is example like:

#include <fmt/format.h>

int main() {
  using namespace fmt::literals;
  fmt::print("{abc} {1}", "abc"_a = 42, "abc"_a = 43 );
}

This prints: "42 43"

Or this example:

#include <fmt/format.h>

int main() {
  using namespace fmt::literals;
  fmt::print("{abc}", "abc"_a = 42, "abc"_a = 43 );
}

This prints: "42"

Is this semantics like this by design or did it happen by mistake?

@lewkok lewkok changed the title Duplicated named arguments are ignored for Duplicated named arguments are ignored Jan 1, 2025
@lewkok lewkok changed the title Duplicated named arguments are ignored Duplicated named arguments are ignored, but not rejected Jan 1, 2025
@vitaut
Copy link
Contributor

vitaut commented Jan 1, 2025

That's just an implementation artifact and I think we could add validation.

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

No branches or pull requests

2 participants