Does GCC support C++20 std::format?

Viewed 19607
3 Answers

As of September 2022, NO, GCC 12 doesn't support std::format yet.

MSVC (version 16.10 and above) is the only compiler that fully supports std::format. Clang 14 (with libc++14) also has almost full support for std::format.

Since std::format is based on fmt library, you can use fmt::format until std::format arrives in GCC.

{fmt} library GitHub repo


See Compiler support here :-

As of today (5 September 2022), GCC 12.2 does not support this feature. Or rather, its standard library implementation doesn't support it (cause it's a library feature, not the compiler-one).

You can try Clang 14.0.0 and upward for now, but note following:

libc++ of Clang 14.0.0 has std::format support but: "The paper is implemented but still marked as an incomplete feature. Not yet implemented LWG-issues will cause API and ABI breakage" as mentioned here

Also you can try MSVC 16.10 and upward. Support of std::format is mentioned as complete.


Standard library current status can be seen here:

Related