[Bug c++/15912] New: No warnings emitted for non-void functions with missing return values
jan at etpmod dot phys dot tue dot nl
gcc-bugzilla@gcc.gnu.org
Thu Jun 10 19:18:00 GMT 2004
consider:
int f1() {}
template <class T> int f2() {}
struct S {
int f() {}
static int s() {}
};
int main()
{
f1();
f2<int>();
S::s();
S s;
s.s();
return 0;
}
There are two bugs:
1) Compiling this snippet without warning options does not generate warnings
for the missing return values, contrary to the gcc man page which says that
these situations should always be diagnosed (in C++).
2) Compilation with -Wall and/or -Wreturn-type fails to diagnose the problem
in the regular free function f1. The function template, the function member
and the static function in class scope are correctly recognized as
problematic.
--
Summary: No warnings emitted for non-void functions with missing
return values
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: jan at etpmod dot phys dot tue dot nl
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i586-suse-linux
GCC host triplet: i586-suse-linux
GCC target triplet: i586-suse-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15912
More information about the Gcc-bugs
mailing list