Problem with implicit conversion (GCC 3.4.1)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have written a program that compiles just fine with GCC 3.3. With
GCC 3.4.1 it results in this error:

g++ -O0 -g3 -Wall -c -oTestp.o ../Testp.c
../Testp.c: In function `int main()':
../Testp.c:26: error: no match for 'operator<=' in 't <= 2.0e+0'

Please help me, I have no idea where the problem is.

Here is the code:

template <class T> class BasisF;
	
template <class T> inline bool operator<=(const BasisF<T> &a, const
BasisF<T> &b){return a.x <= b.x;}

template<class T> class BasisF{

public:
	T x;
	BasisF(const T &_x = T()): x(_x){}
	BasisF(const BasisF &_b): x(_b.x){}
	~BasisF(){}
	BasisF& operator= (const T &_x){
		 x(_x);
		 return *this;
	}
	friend bool operator<=<>(const BasisF &a, const BasisF &b);
	};

#define min(a,b) ((a) <= (b) ? (a) : (b))

int main(){
	BasisF<double> t(1);
	if (min(t,2.0)<=0) return 1;
	return 0;
}

Regards,
Boris

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux