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

Fix warning C4702 emitted from format.h (MSVC) #3866

Merged
merged 1 commit into from
Feb 28, 2024

Conversation

Baardi
Copy link
Contributor

@Baardi Baardi commented Feb 24, 2024

Compiler: MSVC, Windows x64, Visual Studio 17.9.1
C++ standard: Any (recreatable with anything from c++14 to c++latest)
Fmtlib version: Master branch
Warning level: /W4 or higher

Hi. This is a new warning, not emitted when using the 10.2.1-release, but recreatable from the master branch.

It can easily be recreated by the following lines of code:

#define FMT_HEADER_ONLY
#include <fmt/format.h>

void test()
{
   fmt::println("test");
}

bilde

It seems that the default-label in the switch-case prevents execution from reaching the bottom of the function. MSVC therefore emits a warning. I haven't tested this on other platforms

@vitaut vitaut merged commit ae1e93d into fmtlib:master Feb 28, 2024
41 checks passed
@vitaut
Copy link
Contributor

vitaut commented Feb 28, 2024

thanks

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