This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
GCC 2.95.2: control reaches end of non-void function
- To: gcc-bugs at gcc dot gnu dot org
- Subject: GCC 2.95.2: control reaches end of non-void function
- From: Dennis Bjorklund <dennisb at cs dot chalmers dot se>
- Date: Wed, 21 Jun 2000 18:05:10 +0200 (MET DST)
Hi!
There is a strange warning for this program. Clearly the function f() will
return something.
// c++ -v
// Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.95.2/specs
// gcc version 2.95.2 19991024 (release)
//
// c++ -Wall -O1 -c dummy.cpp
// dummy.cpp: In function `bool f()':
// dummy.cpp:27: warning: control reaches end of non-void function `f()'
#include <string>
#include <vector>
template<class T>
class D {
std::vector<T> x;
public:
~D() {};
};
bool f()
{
D<std::string> dummy;
if( 1 )
return true;
else
return false;
}
/Dennis