The C++20’s u8/char8_t Backward-Compatibility Fiasco 0 ▲ Giovanni Dicanio's Blog 1 hour ago · Tech · hide · 0 comments There is a myth according to which every new C++ version is backward compatible with the older versions. While there is a common general trend to try and keep backward compatibility across different C++ versions, that’s not always the case. A “recent” example is provided by C++20’s u8 and char8_t. Consider the following C++ code snippet: // This function takes a UTF-8 string as input, // and does something with it. void DoSomething(const char* utf8Text); ... int main() { // A UTF-8 string literal auto s = u8"Connie plus some UTF-8 stuff..."; DoSomething(s); } The above code compiles successfully in C++17 mode. Now you want to be cool and update your language standard to C++20, because, you know, we are in 2026 Well, surprise, surprise…the same code will not compile in C++20 mode! Microsoft VC++ compilation error when switching to C++20 mode. The MSVC compiler complains with the following error message: ‘void DoSomething(const char *)’: cannot convert argument 1 from ‘const char8_t *’… No comments yet. Log in to reply on the Fediverse. Comments will appear here.