From: Boris von Loesch <vonloesch@gmail.com>
To: gcc-help@gcc.gnu.org
Subject: Problem with implicit conversion (GCC 3.4.1)
Date: Thu, 26 Aug 2004 14:16:00 -0000 [thread overview]
Message-ID: <41a2e2dc04082602547057f04c@mail.gmail.com> (raw)
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
next reply other threads:[~2004-08-26 9:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-26 14:16 Boris von Loesch [this message]
2004-08-26 17:46 lrtaylor
2004-08-26 19:54 Suresh Lakshmanan
2004-08-26 22:17 ` Boris von Loesch
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41a2e2dc04082602547057f04c@mail.gmail.com \
--to=vonloesch@gmail.com \
--cc=gcc-help@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).