This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

GCC 2.95.2: control reaches end of non-void function


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]