as bug
Milos Grundman
grundman@mip.ups-tlse.fr
Thu Dec 3 08:23:00 GMT 1998
// gcc version egcs-2.91.56 19980829 (egcs-1.1 pre-release)
// gcc version pgcc-2.91.57 19980901 (egcs-1.1 release)
// compiles with -O and not without -O
#include <iostream.h>
template <int dgr> class simple_vector
{
protected:
simple_vector<dgr-1> rest;
public:
template <int j> double v() const { return 0.0; };
template <> double v<0>()const{return 0.0; }; // the problem is
here
ostream& print (ostream& stream) const
{
double x = v<0>();
return rest.print(stream);
};
};
template <> class simple_vector<0>
{
public:
ostream& print (ostream& stream) const { return stream; };
};
void main()
{
simple_vector<3> a;
a.print(cout);
}
More information about the Gcc-bugs
mailing list