[clang] Better diagnostics when assertion fails in `consteval` (PR #130458)

A. Jiang via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 04:03:06 PDT 2025


================
@@ -107,6 +107,8 @@ def err_ice_too_large : Error<
   "integer constant expression evaluates to value %0 that cannot be "
   "represented in a %1-bit %select{signed|unsigned}2 integer type">;
 def err_expr_not_string_literal : Error<"expression is not a string literal">;
+def note_constexpr_assert_failed : Note<
+  "assertion failed in consteval context: '%0'">;
----------------
frederick-vs-ja wrote:

How about:
```suggestion
  "assertion failed in constant evaluation: '%0'">;
```
(Given that `consteval` is a C++20 keyword, while the phrase "constant evaluation" looks like plain English.)

https://github.com/llvm/llvm-project/pull/130458


More information about the cfe-commits mailing list