[PATCH] D146408: [clang][Interp] Start supporting complex types
Aaron Ballman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 28 12:23:20 PDT 2023
aaron.ballman added a comment.
I don't think the `_BitInt` test case should block this patch if that turns out to cause problems.
================
Comment at: clang/lib/AST/Interp/EvalEmitter.cpp:212-214
+ });
+ return false;
+ } else if (ElemTy->isFloatingType()) {
----------------
The switch is fully covered with an unreachable, and the outer level returns `false` anyway.
================
Comment at: clang/lib/AST/Interp/PrimType.h:108
+ switch (Expr) { \
+ TYPE_SWITCH_CASE(PT_Sint8, B) \
+ TYPE_SWITCH_CASE(PT_Uint8, B) \
----------------
Oh boy, this is going to be interesting, isn't it?
```
consteval _Complex _BitInt(12) UhOh() { return (_Complex _BitInt(12))1; }
consteval _Complex _BitInt(18) Why() { return (_Complex _BitInt(18))1; }
static_assert(UhOh() + Why() == 2);
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146408/new/
https://reviews.llvm.org/D146408
More information about the cfe-commits
mailing list