[clang] [LifetimeSafety] Fix crash on ternary operator when one of the expressions is `throw` (PR #190345)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 6 08:49:57 PDT 2026


usx95 wrote:

I do not think the issue is a no-returning CFGBlock. E.g. the `noreturn` example works fine.

```cpp
[[noreturn]] int* terminate();

bool cond;
int* f() {
    int p;
    return cond ? &p : terminate();
}
```
https://godbolt.org/z/1rTdEvGKo

 The crash is because the `CXXThrowExpr` has a type `void` in the AST which has no origins while the destinations have.

So this indeed looks like a special case of a throw expression and not specific to control flow. WDYT @Xazax-hun 

https://github.com/llvm/llvm-project/pull/190345


More information about the cfe-commits mailing list