https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71517
Bug ID: 71517 Summary: g++ gives different warnings if compiling a file directly or adding preprocess step Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: albert.astals at canonical dot com Target Milestone: --- Compiling the file at http://paste.ubuntu.com/17091697/ I get no warnings if just using -c $ g++ -c -fPIC -Wsuggest-override -isystem /usr/include/x86_64-linux-gnu/qt5/ q.cpp $ But if i add -E step i do get warnings $ g++ -E -fPIC -Wsuggest-override -isystem /usr/include/x86_64-linux-gnu/qt5/ q.cpp > preprocess.cpp $ g++ -c -fPIC -Wsuggest-override -isystem /usr/include/x86_64-linux-gnu/qt5/ preprocess.cpp q.cpp:5:75: warning: ‘virtual const QMetaObject* Moo::metaObject() const’ can be marked override [-Wsuggest-override] q.cpp:5:109: warning: ‘virtual void* Moo::qt_metacast(const char*)’ can be marked override [-Wsuggest-override] q.cpp:5:148: warning: ‘virtual int Moo::qt_metacall(QMetaObject::Call, int, void**)’ can be marked override [-Wsuggest-override] $ Don't know if the warning should be reported in the first case or not reported in the second case but seems a bit inconsistent to have it in one case and not in the other.