fmtlib / fmt

A modern formatting library
https://fmt.dev
Other
20.74k stars 2.49k forks source link

FMT_STRING compile time checking not working with vprint, vformat... #3238

Closed maxkunes closed 1 year ago

maxkunes commented 1 year ago

I took the example from here: https://fmt.dev/latest/api.html#argument-lists and got it compiling with compiler explorer. Unfortunately, it seems that compile time checking is not working properly with vprint or vformat... functions.

I assume I am doing something wrong, but the wiki doesn't seem to have any examples of this since the deprecation of make_args_checked. The wiki's godbolt link is using the old API that no longer compiles.

https://godbolt.org/z/KMTf13a1s shows the issue. Notice that we are getting a runtime error for something that should be a compile time error.

mwinterb commented 1 year ago

The documentation wasn't fully updated for 9.0. https://fmt.dev/dev/api.html#argument-lists is the documentation for HEAD, but the sample works fine for 9.0.

On Wed, Dec 21, 2022, 18:43 Max Kunes @.***> wrote:

I took the example from here: https://fmt.dev/latest/api.html#argument-lists and got it compiling with compiler explorer. Unfortunately, it seems that compile time checking is not working properly with vprint or vformat... functions.

I assume I am doing something wrong, but the wiki doesn't seem to have any examples of this since the deprecation of make_args_checked. The wiki's godbolt link is using the old API that no longer compiles.

https://godbolt.org/z/KMTf13a1s shows the issue. Notice that we are getting a runtime error for something that should be a compile time error.

— Reply to this email directly, view it on GitHub https://github.com/fmtlib/fmt/issues/3238, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIID34S7ZQGWLOFS7DNI23WOO55HANCNFSM6AAAAAATGHXBGA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

maxkunes commented 1 year ago

Thanks for the quick response, that resolved the issue. Thanks!