[PATCH] D130894: [clang] Print more information about failed static assertions
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 5 07:38:21 PDT 2022
aaron.ballman added a comment.
In D130894#3702233 <https://reviews.llvm.org/D130894#3702233>, @tbaeder wrote:
> I don't know much about fixit hints, would they be appropriate to display it below the line itself, e.g.
>
> test.cpp:24:17: note: expression evaluates to
> static_assert(c != c);
> '0' != '0'
> ~~^~~~
Nope, that would be a bad thing -- Clang has the ability to automatically apply fix-it hints to the source, so this would modify the static assertion to continue to be false which isn't much of a fix.
> Or would it be even better to just inline the evaluated expression into the `static_assert` ala
>
> test.cpp:24:17: note: expression evaluates to
> static_assert('0' != '0');
> ~~^~~~
Making sure I'm following along, you mean that we'd display the error for the static assertion, and then the note would show `static_assert(<actual values in the reconstituted expression>)`?
I think this might work for very simple static asserts, but what about more complicated ones like `static_assert(foo() && (bar() == 12 || baz()) && 'a' != quux(4000));`?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D130894/new/
https://reviews.llvm.org/D130894
More information about the cfe-commits
mailing list