[PATCH] D141392: Avoid u8"" literals in tests, their type changes in C++20

Jens Massberg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 11 04:56:52 PST 2023


massberg added a comment.

In D141392#4040037 <https://reviews.llvm.org/D141392#4040037>, @ilya-biryukov wrote:

> Are there any uses of `u8` string literals with `formatted_raw_ostream` outside tests? What was the effect on the final behavior here?
>
> I just wanted to make sure we are not doing the wrong thing here. If the code used to compile and it now changes behavior, we may run into runtime failures in real code.
> If that's the case, we could potentially consider adding overloads for `u8` string literals to either support it or with `=delete` to make sure the code using them will be rewritten.

`u8""` literals (respectively `char8_t*`) used with ostreams changed behavior in C++20 in an unexpected way, see e.g.
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r1.html#option7
So the right way might be to ensure that they cannot be used with osteams.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141392/new/

https://reviews.llvm.org/D141392



More information about the llvm-commits mailing list