[PATCH] D146408: [clang][Interp] Start supporting complex types
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 23 10:28:59 PDT 2023
aaron.ballman added inline comments.
================
Comment at: clang/lib/AST/Interp/ByteCodeExprGen.cpp:1595
+ return true;
+ } else if (const auto *CE = dyn_cast<CallExpr>(Initializer)) {
+ if (!this->emitDupPtr(Initializer))
----------------
Member calls as well?
================
Comment at: clang/lib/AST/Interp/Context.cpp:84-85
+ if (T->isAnyComplexType())
+ return std::nullopt;
+
----------------
Hmmm, this seems surprising to me, I would have assumed that _Complex needed to be a primitive type so that we could perform typical math on it rather than treat it as a pair of values.
================
Comment at: clang/test/AST/Interp/complex.cpp:7
+
+constexpr _Complex double z1 = {1.0, 2.0};
+static_assert(__real(z1) == 1.0);
----------------
Can you add tests for `_Complex int` as well? (That's also covered by `isAnyComplexType()`)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146408/new/
https://reviews.llvm.org/D146408
More information about the cfe-commits
mailing list