g++-980308: Problems with template template parameters

Bernd Nottelmann nottelm@ptp283.uni-muenster.de
Tue Mar 10 02:27:00 GMT 1998


Hi

I have already reported this compiler error a few weeks ago,
but noone has responded. :-(
The following code causes an internal compiler error:

/*-------------------bug.C----------------------*/
template < class T, template <class> class E1, template <class> class E2 >
struct Add {
  Add(const E1<T>& e1, const E2<T>& e2) {}
};


template < class T, template <class> class E1, template <class> class E2 >
struct Mul {
  Mul(const E1<T>& e1, const E2<T>& e2) {}
};


template < class T >
struct Lit {
  Lit(const T& t) {}
};


template < class T >
struct Id {
  Add < T, Id, Lit > operator+(const T& t) const {
    return Add < T, Id, Lit >(this, Lit<T>(t));
  }

  Mul < T, Id, Lit > operator*(const T& t) const {
    return Mul < T, Id, Lit >(this, Lit<T>(t));
  }
};
/*-----------------------------------------*/

# g++ -c bug.C
bug.C:25: Internal compiler error 61.
bug.C:25: Please submit a full bug report to `egcs-bugs@cygnus.com'.

Bernd





More information about the Gcc-bugs mailing list