This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: g++; operator==


First of all, this mailinglist only tracks bugzilla
(http://gcc.gnu.org/bugzilla) activity, so getting help
this way is going to fail.

Second, your testcase is invalid C++, to fix it, change
operator== to

   bool operator== (const Int& i2) const {
       return (this->i == i2.i ? true : false);
   }

as you cannot bind a temporary (which Int(2) is) to an
lvalue reference.

Your other compilers are wrong in accepting the code.

Richard.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]