[clang] [clang][bytecode] Support compile-time exceptions (PR #189410)
Yanzuo Liu via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 4 07:48:32 PDT 2026
================
@@ -69,6 +69,14 @@ bool InterpState::inConstantContext() const {
InterpState::~InterpState() {
assert(Current->isBottomFrame());
+ // Invoke the dtor func of the allocated exception object block.
----------------
zwuis wrote:
It seems too late.
<details>
<summary>Reproducer</summary>
```cpp
constexpr int f() {
int n = 0;
struct D {
int *p;
constexpr D(int *p) : p(p) {}
constexpr ~D() { ++*p; }
};
try {
throw D{&n};
} catch (...) {
} // The exception object should be destroyed here.
return n;
}
static_assert(f() == 1);
```
</details>
https://github.com/llvm/llvm-project/pull/189410
More information about the cfe-commits
mailing list