[clang] [LifetimeSafety] Fix false negative for GSL Owner type with arrow operator (PR #184725)

Utkarsh Saxena via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 5 05:17:58 PST 2026


https://github.com/usx95 requested changes to this pull request.

Update: Checked by running this inside Google. This works badly with `-Wdangling` with `optional<View>`. I think that might be the reason why this was not done earlier as well.

This needs to be done only for Lifetime Safety (when `RunningUnderLifetimeSafety` is set).

Please also test this. This will likely fail with the current version.

```cpp
void test_optional_view_arrow() {
    const char* p;
    p = std::optional<std::string_view>()->data();
    (void)*p;
}
```



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


More information about the cfe-commits mailing list