This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem with implicit conversion (GCC 3.4.1)
- From: Boris von Loesch <vonloesch at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 26 Aug 2004 11:54:31 +0200
- Subject: Problem with implicit conversion (GCC 3.4.1)
- Reply-to: Boris von Loesch <vonloesch at gmail dot com>
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