Skip to content

Build nolocale-test with /utf-8 on MSVC - #4919

Open
ethanstoner wants to merge 1 commit into
fmtlib:mainfrom
ethanstoner:fix/nolocale-test-utf8-msvc
Open

Build nolocale-test with /utf-8 on MSVC#4919
ethanstoner wants to merge 1 commit into
fmtlib:mainfrom
ethanstoner:fix/nolocale-test-utf8-msvc

Conversation

@ethanstoner

Copy link
Copy Markdown

nolocale-test does not compile with MSVC when FMT_PEDANTIC is on:

include\fmt\base.h(455): error C2338: static_assert failed:
  'Unicode support requires compiling with /utf-8'

The target is built from ../src/format.cc directly (test/CMakeLists.txt:132), so it does not pick up the /utf-8 that CMakeLists.txt:255 adds to the fmt target. unicode-test already guards the same flag the same way at test/CMakeLists.txt:73-75, so this follows that.

It has not shown up in CI because the target only exists under FMT_PEDANTIC, and windows.yml does not set it, while linux.yml:211-212 and macos.yml:46 both do.

Checked at C++20 and C++23 with MSVC 19.44, since I wondered whether it was standard-specific. It is not, it fails at both. After the change the full build succeeds and ctest is 23/23 with FMT_PEDANTIC=ON.


Disclosure: written with AI assistance. The build output above is from my own machine.

nolocale-test compiles src/format.cc directly, so it does not pick up the
/utf-8 that CMakeLists.txt adds to the fmt target. On MSVC the static_assert
in base.h then fires: "Unicode support requires compiling with /utf-8".

The target only exists under FMT_PEDANTIC, which the Windows workflow does not
set, so this has not shown up in CI. unicode-test already guards the same flag
the same way.
@ethanstoner
ethanstoner requested a review from vitaut as a code owner September 4, 2026 14:33
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.

1 participant