8000 8000
Skip to content

Added a FMT_STRING wrapper for system_error() call.#2929

Merged
vitaut merged 1 commit intofmtlib:masterfrom
madmaxoft:FixEnforceCompileString
Jun 7, 2022
Merged

Added a FMT_STRING wrapper for system_error() call.#2929
vitaut merged 1 commit intofmtlib:masterfrom
madmaxoft:FixEnforceCompileString

Conversation

@madmaxoft
Copy link
Copy Markdown
Contributor

Without this change, using fmt with FMT_ENFORCE_COMPILE_STRING in MSVC 2019 results in failed compilation in fmt itself:

10>C:\...\fmt\include\fmt\core.h(2934,39): error C2338: FMT_ENFORCE_COMPILE_STRING requires all format strings to use FMT_STRING. (compiling source file C:\...\frmNearCrossings.cpp)
10>C:\...\fmt\include\fmt\core.h(3077): message : see reference to function template instantiation 'void fmt::v8::detail::check_format_string<,char[21],0>(const S (&))' being compiled
10>        with
10>        [
10>            S=char [21]
10>        ] (compiling source file C:\...\frmNearCrossings.cpp)
10>C:\...\fmt\include\fmt\format-inl.h(83): message : see reference to function template instantiation 'fmt::v8::basic_format_string<char>::basic_format_string<char[21],0>(const S (&))' being compiled
10>        with
10>        [
10>            S=char [21]
10>        ] (compiling source file C:\...\frmNearCrossings.cpp)
10>C:\...\fmt\include\fmt\format-inl.h(83): message : see reference to function template instantiation 'fmt::v8::basic_format_string<char>::basic_format_string<char[21],0>(const S (&))' being compiled
10>        with
10>        [
10>            S=char [21]
10>        ] (compiling source file C:\...\frmNearCrossings.cpp)

(I'm using fmt as a git submodule in another project, using CMake for build and adding target_compile_definitions(fmt-header-only INTERFACE FMT_ENFORCE_COMPILE_STRING=1) to my CMakeLists.txt

I agree that my contributions are licensed under the {fmt} license, and agree to future changes to the licensing.

Copy link
Copy Markdown
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.

This enables the use of FMT_ENFORCE_COMPILE_STRING on MSVC 2019.
@madmaxoft madmaxoft force-pushed the FixEnforceCompileString branch from 3ae8bff to bdf4fa6 Compare June 7, 2022 09:21
@vitaut vitaut merged commit 48b7e3d into fmtlib:master Jun 7, 2022
@madmaxoft madmaxoft deleted the FixEnforceCompileString branch July 26, 2025 20:03
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

0