GCC 2.95.2: control reaches end of non-void function

Dennis Bjorklund dennisb@cs.chalmers.se
Wed Jun 21 09:05:00 GMT 2000


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



More information about the Gcc-bugs mailing list