http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55698
Bug #: 55698 Summary: gcc does not report warning if operator not used : control reaches end of non-void function [-Wreturn-type] Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: maxim.prohore...@gmail.com Two unused functions, but only 1 warning report. But if comment "return 0;" in main - 2 warnings. gcc -Wall -Wno-long-long -pedantic ../gcc_operator/main.cpp -o main.o ../gcc_operator/main.cpp: In function 'int f(double)': ../gcc_operator/main.cpp:5:1: warning: control reaches end of non-void function [-Wreturn-type] -- main.cpp -- int f (double x) { if (x > 0 || x < 0) return 1; } struct value { double x; int operator== (const value &a) { if (a.x < x || a.x > x) return 0; } }; int main (int argc, char **argv) { value a, b; return 0; return a == b; } -- cut -- gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8) yum info gcc Loaded plugins: langpacks, presto, refresh-packagekit Installed Packages Name : gcc Arch : x86_64 Version : 4.7.2 Release : 8.fc18 Size : 32 M