[Bug c++/11138] New: "no match" error when there is a match ...
zolyfarkas@hotmail.com
gcc-bugzilla@gcc.gnu.org
Mon Jun 9 20:10:00 GMT 2003
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
More information about the Gcc-bugs
mailing list