Skip to content

fix: error: invalid 'static_cast' from type 'fmt::v12::locale_ref' to type 'bool'#4627

Merged
vitaut merged 1 commit intofmtlib:masterfrom
marcel-behlau-elfin:fix_static_cast_for_fmt_v12_locale_ref
Dec 9, 2025
Merged

fix: error: invalid 'static_cast' from type 'fmt::v12::locale_ref' to type 'bool'#4627
vitaut merged 1 commit intofmtlib:masterfrom
marcel-behlau-elfin:fix_static_cast_for_fmt_v12_locale_ref

Conversation

@marcel-behlau-elfin
Copy link
Copy Markdown
Contributor

Hi,

i tried to use fmt::gmtime with locale support disabled #define FMT_USE_LOCALE 0.

During compilation I get the following error:

error: invalid 'static_cast' from type 'fmt::v12::locale_ref' to type 'bool'

This error can be fixed by adding a bool operator to locale_ref. I'm not sure if my implementation is correct. At least I can see that fmt::format("{:%Y-%m-%d %H:%M:%S}", fmt::gmtime(time)) returns the correct time string.

@vitaut vitaut merged commit 789aa69 into fmtlib:master Dec 9, 2025
41 checks passed
@vitaut
Copy link
Copy Markdown
Contributor

vitaut commented Dec 9, 2025

Thank you!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants