Assembler errors with g++-2.8.1 & egcs (bug in binutils-2.8.1.0.23?)

Mark Mitchell mmitchell@usa.net
Wed Mar 18 10:51:00 GMT 1998


    Hi,

    now playing with templates I discover new bugs every day,
    they become more and more weird from time to time ...
    Here is the newest: consider the following program:

    /*--------------------------------bug4.C--------------------------------*/
    template <int n> class vec {
	double x[n];

	public:
	vec() {
     for (int i=0; i<n-1; ++i) x[i]=0;
	}

	vec(const vec<n>& v) {
     for (int i=0; i<n; ++i) x[i]=v(i);
	}

	vec(const vec<n-1>& v, const double& y) {
     for (int i=0; i<n-1; ++i) x[i]=v(i);
     x[n-1]=y;
	}

	inline double operator()(const int i) const {
     return x[i];
	}
    };


    template <int n> vec<n>& operator,(const vec<n-1>& v, const double& y) {
	return *(new vec<n>(v, y));
    }

    int main() {
	vec<4> v;
	vec<5> w;
	w=(v,3.);
    }
    /*--------------------------------bug4.C--------------------------------*/
    The compiler accepts the code, but the assembler refuses to work.
    I got the following error message from the (ix86-)assembler:

In case anyone else is in danger of getting over-eager, I'm about to
go to work on this problem.  We don't mangle things correctly, and
that's why we get these assembler messages.  I should have a patch
reasonably soon (by sometime next week at the latest).

-- 
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available



More information about the Gcc-bugs mailing list