[PATCH] D132098: [clang][Interp] Implement inv and neg unary operations
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 18 12:38:48 PDT 2022
aaron.ballman added a comment.
I'd appreciate if we handled unary `~` and `+` soon after this
================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:620
+ case UO_Deref: // *x
+ case UO_Not: // ~x
+ case UO_Real: // __real x
----------------
This is reachable and will always return true thanks to the magic of integer promotions:
```
void func() {
bool b = true;
b = ~b;
}
```
================
Comment at: clang/test/AST/Interp/literals.cpp:2-15
+// RUN: %clang_cc1 -std=c++11 -verify %s -DREFERENCE
static_assert(true, "");
static_assert(false, ""); // expected-error{{failed}}
static_assert(nullptr == nullptr, "");
static_assert(1 == 1, "");
static_assert(1 == 3, ""); // expected-error{{failed}}
----------------
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132098/new/
https://reviews.llvm.org/D132098
More information about the cfe-commits
mailing list