diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-06-23 10:14:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-23 10:14:33 +0200 |
commit | 1c78d8d9d7bcb4b20910047ad7db35f177a17c8c (patch) | |
tree | 52b4b2ccf1c9d04631c4d2d4c3b0922d46fe81e7 /clang/test/AST/ByteCode | |
parent | 529662a6b5f1eec832d35786b6c49da1d21513e8 (diff) | |
download | llvm-1c78d8d9d7bcb4b20910047ad7db35f177a17c8c.zip llvm-1c78d8d9d7bcb4b20910047ad7db35f177a17c8c.tar.gz llvm-1c78d8d9d7bcb4b20910047ad7db35f177a17c8c.tar.bz2 |
[clang][bytecode] Fix shifts with an allocated RHS (#145280)
This was broken before because we ended up using a constructor that was
disabled via assert(false). Use ShiftAP() if either LHS or RHS is
allocated.
Diffstat (limited to 'clang/test/AST/ByteCode')
-rw-r--r-- | clang/test/AST/ByteCode/intap.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/intap.cpp b/clang/test/AST/ByteCode/intap.cpp index 3f952dd..11dd9ed 100644 --- a/clang/test/AST/ByteCode/intap.cpp +++ b/clang/test/AST/ByteCode/intap.cpp @@ -273,4 +273,18 @@ namespace IncDec { #endif } +#if __cplusplus >= 201402L +const __int128_t a = ( (__int128_t)1 << 64 ); +const _BitInt(72) b = ( 1 << 72 ); // both-warning {{shift count >= width of type}} +constexpr int shifts() { // both-error {{never produces a constant expression}} + (void)(2 >> a); // both-warning {{shift count >= width of type}} \ + // both-note {{shift count 18446744073709551616 >= width of type 'int' (32 bits)}} + (void)(2 >> b); // ref-warning {{shift count is negative}} + (void)(2 << a); // both-warning {{shift count >= width of type}} + (void)(2 << b); // ref-warning {{shift count is negative}} + return 1; +} +#endif + + #endif |