Open
Description
#include <optional>
struct S {
std::optional<int> o1 = {}; // warns here, OK
std::optional<int> o2 = std::nullopt; // should also warn here, but it doesn't
};
<source>:4:27: warning: initializer for member 'o1' is redundant [readability-redundant-member-init]
4 | std::optional<int> o1 = {};
|
https://godbolt.org/z/jzTcf5rs1
Related: #43786