public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Problem with overloaded function selection
@ 2002-08-12  3:25 Andrey Pozdeev
  2002-08-12  7:01 ` bjorn rohde jensen
  0 siblings, 1 reply; 6+ messages in thread
From: Andrey Pozdeev @ 2002-08-12  3:25 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Problem with overloaded function selection
@ 2002-08-12  3:22 Andrey Pozdeev
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Pozdeev @ 2002-08-12  3:22 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 6+ messages in thread
* Problem with overloaded function selection
@ 2002-08-12  3:18 Andrey Pozdeev
  0 siblings, 0 replies; 6+ messages in thread
From: Andrey Pozdeev @ 2002-08-12  3:18 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-08-12 14:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <616BE6A276E3714788D2AC35C40CD18D780D92@whale.softwire.co.uk>
2002-08-12  7:07 ` Problem with overloaded function selection Rupert Wood
2002-08-12  7:13   ` bjorn rohde jensen
2002-08-12  3:25 Andrey Pozdeev
2002-08-12  7:01 ` bjorn rohde jensen
  -- strict thread matches above, loose matches on Subject: below --
2002-08-12  3:22 Andrey Pozdeev
2002-08-12  3:18 Andrey Pozdeev

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).