https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100047
--- Comment #1 from Björn Fahller <gccbugbjorn at fahller dot se> --- Created attachment 50570 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50570&action=edit Test program exposing the bug bf@pteranodon /tmp> g++-10 -c -std=c++17 -Wmaybe-uninitialized ./t.cpp -Og # no warning bf@pteranodon /tmp> g++-10 -c -std=c++17 -DEXPOSE_BUG -Wmaybe-uninitialized ./t.cpp -Og ./t.cpp: In function ‘std::string func()’: ./t.cpp:30:34: warning: ‘<anonymous>.packet_buffer::m_size’ may be used uninitialized in this function [-Wmaybe-uninitialized] 30 | size_t size() const { return m_size; } // <- here | ^~~~~~