public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: bjorn rohde jensen <bjensen@fastmail.fm>
To: Andrey Pozdeev <AndreyPozdeev@rambler.ru>
Cc: gcc-help@gcc.gnu.org
Subject: Re: Problem with overloaded function selection
Date: Mon, 12 Aug 2002 07:01:00 -0000	[thread overview]
Message-ID: <3D57BFBF.E3872801@fastmail.fm> (raw)
In-Reply-To: <3D578A07.AA20189@mb1.rambler.ru>

Hi Andrey,

The conversions

>     operator double() {return 0L;};
>     operator int() { return 0; };

 are equally poor, as one level of user defined
conversions and one level of default conversions
are required to match

> void test(char){};

 Having both conversions causes neither to be
considered, which means that

>     operator A() { return A();};

is the only choice.

 Removing either of
>     operator double() {return 0L;};
>     operator int() { return 0; };

 makes the call
>   test(b);

 ambiguous, since
> void test(char){};

is a candidate through one level of user defined
conversions and one level of default conversions
and

> void test(A){};
is a candidate through one level of user defined
conversions.

 I guess, one will have to look in the specs to
see, who is right in this matter. My gut feeling
is, that it gcc is right. Conversions and function
overloading seem pretty othogonal to me. Why should
two conversions be worse than one conversion in matching
an overloaded function??

Yours sincerely,

Bjorn

  reply	other threads:[~2002-08-12 14:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-12  3:25 Andrey Pozdeev
2002-08-12  7:01 ` bjorn rohde jensen [this message]
     [not found] <616BE6A276E3714788D2AC35C40CD18D780D92@whale.softwire.co.uk>
2002-08-12  7:07 ` Rupert Wood
2002-08-12  7:13   ` 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3D57BFBF.E3872801@fastmail.fm \
    --to=bjensen@fastmail.fm \
    --cc=AndreyPozdeev@rambler.ru \
    --cc=gcc-help@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).