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

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

Merged
merged 1 commit into from
Jun 7, 2022

Conversation

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

include/fmt/format-inl.h Outdated Show resolved Hide resolved
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
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