I wonder if this is expected behavior this is on a recent fedora 32 x86_64 system g++ (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11) Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. To trigger a lengthy list of deductions, I use the following three files and g++ -fanalyzer main.cpp line.cpp Using only the given warning flag triggers nothing g++ -Wanalyzer-null-dereference main.cpp line.cpp ///// begin of main.cpp /////////// #include <string> #include <vector> #include "line.h" int main() { std::vector<std::string> m_Text; std::vector<Line> m_Lines; for( const auto& line : m_Text ) { m_Lines.emplace_back(line); } return 0; } ///// end of main.cpp ///////////// ///// begin of line.h /////////// #ifndef LINE_H #define LINE_H #include <string> class Line { public: explicit Line( const std::string& data ); const std::string& data() const; private: std::string m_Data; }; #endif /* LINE_H */ ///// end of line.h ///////////// ///// begin of line.cpp /////////// #include "line.h" Line::Line( const std::string& data ) : m_Data(data) {} const std::string& Line::data() const { return m_Data; } ///// end of line.cpp /////////////