2.95.1 C++ bug?

JDonner jdonner@schedsys.com
Thu Sep 9 16:58:00 GMT 1999


Hi,

  The following produces an error on gcc 2.95.1; 
VC6 sp3 accepts it fine; is this a bug?

thanks,

Jeff


// bugtest.cpp line 1
class ObjClass;

class Obj {};

class ObjClass : public Obj
{
public:
  ObjClass(Obj *(pfnCreate)() = 0);
};

class D : public Obj
{
public:
  static Obj* Create();
  int Create(int n);

  static const ObjClass classD;
};

// next is line 22
const ObjClass D::classD(D::Create);

Obj* D::Create() { return 0; }
int D::Create(int n) { return 0; }

int main()
{
  return 0;
}


gcc -Wall bugtest.cpp
bugtest.cpp: In function `void
__static_initialization_and_destruction_0(int, int)':
bugtest.cpp:22: assuming & on overloaded member function

Compilation exited abnormally with code 1 at Thu Sep  9 19:51:10


gcc -v
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/2.95.1/specs
gcc version 2.95.1 19990816 (release)


More information about the Gcc-bugs mailing list