MSVC: Conditional expression is constant warning when formatting `tm` with unicode disabled · Issue #4294 · fmtlib/fmt · GitHub
Skip to content

MSVC: Conditional expression is constant warning when formatting tm with unicode disabled #4294

Description

@edo9300

When formatting a tm struct with unicode support disabled, MSVC outputs the warning C4127 on this row


this is a sample repro scenario

#define FMT_UNICODE 0
#include <fmt/core.h>
#include <fmt/chrono.h>
#include <ctime>

int main() {
	auto now = std::time(nullptr);
	fmt::format("[{:%Y-%m-%d %H:%M:%S}]", fmt::localtime(now));
	return 0;
}

(compile with /W4)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions