Bug report
Philippe Bouchard
boucp00@DMI.USherb.CA
Thu Oct 28 10:15:00 GMT 1999
I'm not sure if it is a bug, but would be interesting to fix. Here is the
source:
#include <iostream.h>
template <class TYPE> class H {
ÃÂ ÃÂ TYPE * p;
ÃÂ
public:
ÃÂ ÃÂ void operator = (void * o) {
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ p = (TYPE *) o;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ }
ÃÂ
ÃÂ ÃÂ ~H() { if (p) delete p; }
ÃÂ
ÃÂ ÃÂ TYPE * operator -> () {
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ return p;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ }
ÃÂ ÃÂ };
signature S {
ÃÂ ÃÂ void func();
ÃÂ ÃÂ };
struct O {
ÃÂ ÃÂ void func() { cout<<__PRETTY_FUNCTION__<<endl;
}
ÃÂ ÃÂ };
void main() {
ÃÂ ÃÂ // Works well (prints 'void O::func()'):
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ {
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ S * s;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ s = new O;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ s->func();
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ }
ÃÂ
ÃÂ ÃÂ // Doesn't:
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ {
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ H<S> s;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ s = new O;
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ s->func();
ÃÂ ÃÂ ÃÂ ÃÂ ÃÂ }
ÃÂ ÃÂ }
Doesn't compile & prints:
[...]$ g++ -fhandle-signatures signature1.cc
signature1.cc: In function `int main(...)':
signature1.cc:38: no matching function for call to `S::func ()'
signature1.cc:19: candidates are: S::func()
Current version:
[...]$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
ÃÂ
PAB
More information about the Gcc-bugs
mailing list