int f(int i) { if (i == undefined_var) { return 1; } else { return 0; } }
/usr/local/gcc-svn/bin/g++ -Wall -Wextra -c bad-return.cpp bad-return.cpp: In function int f(int): bad-return.cpp:3:13: error: undefined_var was not declared in this scope bad-return.cpp:9:1: warning: control reaches end of non-void function [-Wreturn-type] Happens as .c and gcc, and as .cpp with g++. The warning does not occur in 4.4.3. Untried with 4.5.x. -- Summary: False warning: 'control reaches end of non-void function' when comparing to undefined var Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jeffrey dot donner at gmail dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44106