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

via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 7 10:54:01 PDT 2026


NeKon69 wrote:

So my code crashes on

```cpp
[[noreturn]] int *noret_f(int *p);

int *noreturn_dead_false(bool cond, int *num) {
  int local = 0;
  return cond ? num : noret_f(&local);
}
```

with `Assertion 'Dst->getLength() == Src->getLength() && "Lists must have the same length"'`. I ran this example through a debugger, and it looks like it goes through exactly the path it’s supposed to take: it flows through the `true` branch and ignores the `false`(`noreturn`) branch. But the interesting part is that it crashes when we flow through the `true` branch. I assume I missed something obvious in the code..

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


More information about the cfe-commits mailing list