"error C2015: too many characters in constant" for a char32_t literal

char32_t c = U'▁' works under GCC and Clang, but fails under MSVC with the error

error C2015: too many characters in constant 

U'\u2581' works, but is this a compiler bug? Microsoft's String and character literals documentation doesn't seem to say anything about it not being supported, but maybe I've missed something relevant.

6

1 Answer

@remy-lebeau and @mark-tolonen are correct. I had this issue and adding the /utf-8 compiler flag is what I needed. My source file was using utf-8. I am using VS 2022 (17.4.4).

See

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like