This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11138] New: "no match" error when there is a match ...
- From: "zolyfarkas at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jun 2003 20:10:30 -0000
- Subject: [Bug c++/11138] New: "no match" error when there is a match ...
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11138
Summary: "no match" error when there is a match ...
Product: gcc
Version: 3.2
Status: UNCONFIRMED
Severity: major
Priority: P2
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: zolyfarkas@hotmail.com
CC: gcc-bugs@gcc.gnu.org
Is this a bug ? Maybe ...
Here is the description ...
the following code :
class a
{
int i;
public:
a(){i=0;}
friend a operator+(a&, a&);
};
a operator+(a& a1, a& a2)
{
return a();
}
int main(void)
{
a res = a() + a();
return 0;
}
gives the following compilation error:
test.cc: In function `int main()':
test.cc:18: no match for `a + a' operator
test.cc:10: candidates are: a operator+(a&, a&)
test.cc:10: a operator+(a&, a&)
I shouldn't get this error ...
if i change the line with the error to the following : a res = (a&)a() + (a&)a
(); //it compiles
I should not need to do explicit casts is this case ...
I am working on a Solaris 9 sparc system
thanks