This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Problem with overloaded function selection
- From: Andrey Pozdeev <AndreyPozdeev at rambler dot ru>
- To: gcc-help at gcc dot gnu dot org
- Cc:
- Date: Mon, 12 Aug 2002 14:12:23 +0400 (MSD)
- Subject: Problem with overloaded function selection
I tried to compile the following example using GCC and MS Visual C++:
-----------
class A
{
public:
A(){};
};
class B
{
public:
operator double() {return 0L;};
operator int() { return 0; };
operator A() { return A();};
};
void test(char){};
void test(A){};
int main()
{
B b;
test(b);
return 0;
}
-------------
Both compilers compiles this example succesfully.
But if we comment line with 'operator double' or with 'operator int' then GCC
will complain, Visual C++ will not.
What's the matter ?
Andrey.
----
http://www.rambler.ru