Issue 80862
Summary [Clang-Tidy] Create readability-unambiguous-optional-assigment check
Labels clang-tidy, check-request
Assignees
Reporter PiotrZSL
    I'm adding this here so, i wouldn't forget. Check name to negotiation.

```
std::optional<int> opt;
...
opt = {};
opt = std::optional<int>();
```

Problem with above, is that it's not so straightforward. I run into issue when developer initialized optional with `= std::optional<...>()` and were thinking that optional is actually set.

In std::optional we got very nice methods called `reset` and `emplace`. I would argue that they should be used instead of above examples. Even `std::nullopt` is better.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to