diff options
author | Corentin Jabot <corentinjabot@gmail.com> | 2025-07-04 16:40:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-04 16:40:29 +0300 |
commit | af2bb8f826050402fa9c6a6be8475808dcb63df0 (patch) | |
tree | a9fcce58cdd7894845b929a17b429ddb09ad8a0f /flang/lib/Frontend/CompilerInvocation.cpp | |
parent | ad20dc0a87fc34666dcd75390c149d5ea55a0fbd (diff) | |
download | llvm-af2bb8f826050402fa9c6a6be8475808dcb63df0.zip llvm-af2bb8f826050402fa9c6a6be8475808dcb63df0.tar.gz llvm-af2bb8f826050402fa9c6a6be8475808dcb63df0.tar.bz2 |
[Clang] Correctly handle allocations in the condition of a `if constexpr` (#146890)
Deal with the following scenario
```cpp
struct S {
char* c = new char;
constexpr ~S() {
delete c;
}
};
if constexpr((S{}, true)){};
```
There were two issues
- We need to produce a full expression _before_ evaluating the condition
(otherwise, automatic variables are never destroyed)
- We need to preserve the evaluation context of the condition while
doing the semantics analysis for it (lest it is evaluated in a
non-constant-evaluated context)
Fixes #120197
Fixes #134820
Diffstat (limited to 'flang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions