<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/124985>124985</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [clang] Should escape sequences be rendered in static_asserts?
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          torshepherd
      </td>
    </tr>
</table>

<pre>
    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.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0U02P5CYU_DX48uSWeTb-OPgw06OO5pIcNlKOKwzPNlkavIBndv99hN07UbRSbishdcsUr6qgSsZoFkc0MvHMxEsh97T6MCYf4krbSkEXk9ffxz9XE8FE2IKf5GS_g3GJnCYNE63yzfjA8ArTnuAV3qVLpCF5mK1cIK0ygbLSLQy7CKt02hq3gJ_h6fdPr0BRyY1AeU1gHMQkk1GfZYwU0sGpzTxTIJfyKJcxv12vF1Y95dVW51Lbxqon5V1M9G0LEJNm9ROrn2IKxi2f3wy9QwJWvwBDZOL6jU9MPNf8fliLq99tNgOB9Mdudc_Y-vnk-o8yhn2VLSeGwwPxQ8qJ_sOdpoFhn8LuvmQgXmELxqWYtZ0GkDPx_HqXCzHxwrBfU9qObbwxvC0mrft0Uf7O8LZHCqVMSar1TnkI3rKY448SqFAIVTaznMumk33Zi6Yrh3rqWinbZmoxKzhI_1opkIz5HkveXPBXiWqGduadHMp5UKJsKhTlJAdR1hL7mbBvNVYfoo53kNb69wizDzDvDtJq3BIh7moFGSHkyOXnBJO1xZwF5a0PPwXHeAezNHYPFH8k0_ljXMamlTLeaRk0vIKSJ9WXHMpAX3cTKOYv8SPel0KPtR7qQRY08q7ueS8q3hTrSDVvBqJet9TxoWq47GXPK5ratp3UPBRmxApFxXFAziveXDoxEfVtj93QNRNq1lR0l8ZerH27X3xYChPjTiPHZuhFYeVENh4NRXwUCXNZw5gPlNO-RNZU1sQU_x2RTLJHrc8T4gU-nRl_9C3S152coniGPl8s6Z8LyOpbsQc7_k8CMuXjp9yC_5tUYng7LOQQPFy8jfhPAAAA___3j2kJ">