Bug report 1 - extra info

Johan Cockx cockx@imec.be
Fri Jan 22 04:13:00 GMT 1999


Hi,

I already reported this problem yesterday,  but left out some information you
may need:
% g++ -v
Reading specs from
/imec/software/gnu/HPUX10/egcs-1.1b/lib/gcc-lib/hppa1.1-hp-hpux10.20/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
% uname -a
HP-UX yeti B.10.20 E 9000/879 1508324392 8-user license


/*

g++ -O -DGCC t.C
t.C: In instantiation of `Spawner<FX>':
t.C:27:   instantiated from here
t.C:27: Internal compiler error.
t.C:27: Please submit a full bug report to `egcs-bugs@cygnus.com'.

*/

#include <iostream.h>

//------------------------------------------------------------------------------
template<typename P,typename F> class Function {
  F _f;
public:
  Function(F f): _f(f) {}
  void body() { _f(); }
};

//------------------------------------------------------------------------------
template<typename P, typename F> typename P::Task* spawn(P* p, F f) {
  return new typename P::Task(p);
}

//------------------------------------------------------------------------------
template<typename P> class Spawner {
  P* _p;
public:
  Spawner(P* p) : _p(p) {}

  template<typename F> typename P::Task* spawn(F f) { ::spawn(_p,f); return 0; }
};

//------------------------------------------------------------------------------
class FX: public Spawner<FX> {
public:
  class Task {
    FX* _fx;
  public:
    virtual void body() {}
    Task(FX* fx): _fx(fx) { cout << "FX task spawned" << endl; }
  };
  FX() : Spawner<FX>(this) {}
};

//------------------------------------------------------------------------------
void fun() {
  cout << "fun" << endl;
}

//------------------------------------------------------------------------------
int main()
{
  cout << "hello" << endl;
  FX fx;
  fx.spawn(fun);
  cout << "bye" << endl;
}

--
Johan Cockx                    VLSI System Design Methodologies
Senior Research Engineer       IMEC
Tel.: +32(16)281242            Kapeldreef 75
Fax.: +32(16)281515            B-3001 Leuven
mailto:cockx@imec.be           Belgium






More information about the Gcc-bugs mailing list