[clang-tools-extra] [clang-tidy] Ignore unevaluated context in bugprone-optional-value-conversion (PR #90410)

Julian Schmidt via cfe-commits cfe-commits at lists.llvm.org
Wed May 1 13:00:19 PDT 2024


https://github.com/5chmidti commented:

Do we maybe want to explicitly match `decltype`, `sizeof`, `static_cast` etc. instead of `typeLoc`?
Because I don't think we would want to ignore https://godbolt.org/z/r3bK961do

```c++
#include <optional>

constexpr std::optional<int> foo() { return 42; }

constexpr int select(std::optional<int> val) { return val.value_or(0); }

template <int val>
struct bar {};

void use() { using F = bar<select(foo().value())>; }
```

(There are other checks with this ignore pattern, depending on the answer to my question we should check those as well)

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


More information about the cfe-commits mailing list