https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107138
--- Comment #4 from Marco Clemencic <marco.clemencic at gmail dot com> --- I have a similar problem with this chunk of code: ``` #include <map> #include <memory> #include <string> #include <utility> #include <variant> struct Wrapper { using Map = std::map<std::string, std::string>; using Value = std::variant<std::string, Map>; Wrapper(Value v) : data{std::move(v)} {} Value data; }; auto f() { Wrapper::Map r; return std::make_unique<Wrapper>(std::move(r)); // <- warning here // return std::make_unique<Wrapper>(r); // <- no warning // return Wrapper(std::move(r)); // <- no warning } ``` but the uninitialized variable is coming from std::unique_ptr. As in the original report it works with gcc 11.3, but it fails with gcc12.2 and trunk (in my case already with -O1), see https://godbolt.org/z/bfo9vsEPc I attached the .ii produced by my test case.