g++-980308: bug in template template parameter implementation again [Sorry Kriang;-)!]
Bernd Nottelmann
nottelm@ptp283.uni-muenster.de
Fri Mar 13 07:56:00 GMT 1998
Hi,
Unfortunately I have found a new internal compiler error -
though I have installed the two patches from Kriang
( http://www.cygnus.com/ml/egcs-bugs/1998-Mar/0229.html and
http://www.cygnus.com/ml/egcs-bugs/1998-Mar/0255.html ) ...
here is some sample code:
/*-------------------bug3.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 >
struct Id {
template < template < class > class E >
Add < T, Id, E > operator+(const E<T>& e) const {
return Add < T, Id, E >(*this, e);
}
template <> Add < T, Id, Id > operator+(const Id<T>& e) const {
return Add < T, Id, Id >(*this, e);
}
};
/*-------------------bug3.C-------------------*/
# g++ -c bug3.C
bug3.C:16: Internal compiler error.
bug3.C:16: Please submit a full bug report to `egcs-bugs@cygnus.com'.
Thanks in advance
Bernd
PS: anyhow: great work, Kriang! :-)
PPS: Is this still correct C++ at all? I have found nothing in the Stroustrup
which contradicts that.
PPPS: There is still another problem: the compiler doesnôt recognize e.g.
the operation Id<double>& + Id<double>& - although I have defined
this method in struct Id as the first one (thereby the second
template<> Add ... should be disregarded!).
More information about the Gcc-bugs
mailing list