The discussion in PR #57687 turned up an inconsistency in where extended integer constant expressions are accepted: in most contexts Clang accepts boolean expressions involving string literals, it rejects them as the first argument to the _Static_assert expression. This change is my attempt to make _Static_assert consistent with the other contexts and with C++. I looked at how some of the other contexts are handled, hoping to follow their example, but couldn't find a simple way to do it. They all seem quite different from _Static_assert.
There is Expr::ignoreParenImpCasts() or Expr::ImpCasts() that should do this loop for you.
Thank you for working on this! It looks pretty close to good, with just a few comments. Can you also add a release note for the changes as well (to clang/docs/ReleaseNotes.rst)?
+1, I would use Expr::IgnoreImpCasts() instead of this manual loop.
This makes it a bit easier to see there are two diagnostics expected on that line instead of just one.
Changes from previous version:
- Replace loop with Expr::IgnoreImpCasts().
- Use a multiline comment in a test to improve readability.
Sure. Thank you both for the suggestion!