[clang] [clang][Interp] Implement ComplexToReal casts (PR #77294)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 15 05:30:14 PST 2024
Timm =?utf-8?q?B=C3=A4der?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/77294 at github.com>
================
@@ -37,6 +37,18 @@ constexpr _Complex int I2 = {};
static_assert(__real(I2) == 0, "");
static_assert(__imag(I2) == 0, "");
+constexpr int ignoredCast() {
+ I2;
+ (int)I2;
+ (float)I2;
+ D1;
+ (int)D1;
+ (double)D1;
+ return 0;
+}
+static_assert(ignoredCast() == 0, "");
+static_assert((int)I1 == 1, "");
----------------
AaronBallman wrote:
Can you also add:
```
static_assert((float)D == 1.0f, "");
```
to show that we get the correct value out of the floating complex as well?
https://github.com/llvm/llvm-project/pull/77294
More information about the cfe-commits
mailing list