Bug#88260: No warning for missing return in non-void member func
Hi,
the program as is does not generate any warning, indeed. This is
probably because the Foo::Bar method is inline and gcc does not
generate code for it unless it is used.
However, if you add some code to force the method to be used, then g++
warns you. For instance with this code :
#include <map>
#include <string>
using namespace std;
struct Foo : map<string,string> {
string Bar(string) { }
};
int main(void)
{
Foo f;
string s;
s=f.Bar(s);
}
$ g++-3.0 -Wall -c warning.cc
warning.cc: In member function `std::string Foo::Bar(std::basic_string<char,
std::char_traits<char>, std::allocator<char> >)':
warning.cc:7: warning: control reaches end of non-void function
However, g++-2.95 does not give a warning.
Therefore, I think this bug should be reassigned to package g++-2.95.
--
Laurent.
Reply to: