[PATCH] D130894: [clang] Print more information about failed static assertions

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 4 04:21:54 PDT 2022


aaron.ballman added a comment.

In D130894#3698552 <https://reviews.llvm.org/D130894#3698552>, @tbaeder wrote:

>> +1 to the suggestion to use quotes for a bit of visual distinction between the diagnostic message and the code embedded within it.
>
> One problem is that both the integer value `0` and the character constant `'0'` are printed as `'0'` (same for all other single-digit numbers). gcc's output doesn't have that problem because it prints chars as integers, but  I don't really like that.

Agreed on not printing chars as integers, but would printing `''0''` in that case to make it more "clear" that it's a character constant? I think we'd want that for something like `static_assert('a' < 0, "what?")` so it's not printed as `'a < 0'`.


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

https://reviews.llvm.org/D130894



More information about the cfe-commits mailing list