Issue 124985
Summary [clang] Should escape sequences be rendered in static_asserts?
Labels clang
Assignees
Reporter torshepherd
    This is probably intended behavior, but I wanted to flag that clang's handling of ANSI escape code in static_asserts is different than in GCC.

```cpp
constexpr std::string_view t = "\x1b[31mThis should be red\x1b[0m";

static_assert(0, t);
```

On clang (trunk), prints:

![Image](https://github.com/user-attachments/assets/c52c255c-4faf-47a8-8547-93b76aa64b62)

Whereas GCC-14.2 prints:

![Image](https://github.com/user-attachments/assets/496f17a9-f9c5-4025-ba95-3a28fe286d20)

This allows for fun things such as rendering images in color in static_assertion failures, but nothing in the standard I can think of requires this behavior.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to