https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107725
Bug ID: 107725 Summary: Spurious warning: use of uninitialized value with std::any Product: gcc Version: 12.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: cuzdav at gmail dot com Target Milestone: --- Created attachment 53914 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53914&action=edit preprocessed code With the analyzer (-fanalyzer), this built cleanly with GCC10 and GCC11, but starting with GCC 12 (still occurring in trunk) in either C++17 or c++20 mode, I see this warning (x86 linux): <source>:4:13: warning: use of uninitialized value '<unknown>' [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 4 | return {}; | ^ 'std::any create()': events 1-2 | | 3 | std::any create() { | | ^ | | | | | (1) region created on stack here | 4 | return {}; | | ~ | | | | | (2) use of uninitialized value '<unknown>' here | Compiler returned: 0 This is the code in its entirety: #include <any> std::any create() { return {}; } https://godbolt.org/z/TWPcaW4Kn