[clang] [clang] Emit bad shift warnings (PR #70307)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 18 06:50:49 PDT 2024
================
@@ -430,7 +430,8 @@ void dr081(void) {
/* Demonstrate that we don't crash when left shifting a signed value; that's
* implementation defined behavior.
*/
- _Static_assert(-1 << 1 == -2, "fail"); /* Didn't shift a zero into the "sign bit". */
+ _Static_assert(-1 << 1 == -2, "fail"); /* c89only-error {{static assertion expression is not an integral constant expression}}
----------------
AaronBallman wrote:
Something seems wrong here -- why is this an error only in C89 mode? This should be pedantically diagnosed as a warning, not an error (in all C language modes).
https://github.com/llvm/llvm-project/pull/70307
More information about the cfe-commits
mailing list