-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Compile-time error when mixing named argument with automatic indexing #3105
Comments
Good catch, thanks. We should make the diagnostic consistent but in the meantime you can use manual indexing as a workaround:
|
Thanks, I know it works with indexed parameters. Let me add some more details about the use-case: I encountered the issue when I tried to enable compile-time checks for logging in our company, where we already have many messages in code. Changing them to indexed would not practical, nor very nice to the user of such API. The named argument is used to log "strerror", similarly as was common with printf, i.e. original It would be nice if such a logging function could have the format checked in compile-time, but I understand that the named argument support is still somewhat experimental. |
Btw. I don't really understand why it should not work with indexed args. This doesn't seem any problematic to me:
Switching back to automatic ( |
But I see it's the same in Python, so it probably has some reason:
|
Minimal reproducer (godbolt):
I believe this is supposed to compile, but it causes:
Are the named arguments considered as "indexed", or is it a bug?
It works with
fmt::runtime
, so if nothing else, there is a problem with consistency between compile-time and runtime checking.The text was updated successfully, but these errors were encountered: