2.95.1 bug

Brian Evins evins@mailcenter.csap.af.mil
Wed Oct 6 13:02:00 GMT 1999


Bug: stl template of member function pointer, works in 2.91.66 but
     error in 2.95.1

gcc version 2.95.1 19990816 (release)

System: FreeBSD 3.3-RELEASE #0 running on
        Pentium III Xeon 550 dual processor

Compile command line: gcc t.cc

Error output: 

  /usr/local/lib/gcc-lib/i386-portbld-freebsd3.3/2.95.1/include/g++/stl_alloc.h: 
In instantiation of `allocator<void (Event::*)()>':
  t.cc:16:   instantiated from here
  
/usr/local/lib/gcc-lib/i386-portbld-freebsd3.3/2.95.1/include/g++/stl_alloc.h:75
0: `allocator<void (Event::*)()>::address(void (Event::* &)()) const' has 
already been declared in `allocator<void (Event::*)()>'

======  
Please note the same source file compiles without error in version 2.91.66 
1990314

Preprocessed output (t.ii) is t.ii.gz attached for command line:

  gcc -v --save-temps t.cc
  
=======
// t.cc

#include <vector>


class Event {
typedef void (Event::*Pevent_mem) ();  // pointer to member function

public:
   Event();
   void hi() { };	// a member function to point to

   // make a vector of member function pointers
   vector< Pevent_mem > parr;
};

Event::Event()
{
   Pevent_mem pf;	// declare member function pointer
   pf = &Event::hi;	// point to the hi() function
   parr[0] = pf;	// put it into the vector
}

int main()
{
   Event e;
   e.hi();	// eliminate the unused variable warning
}

// end t.cc

// submitted by evins@mailcenter.csap.af.mil


More information about the Gcc-bugs mailing list