public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "konstantin.vladimirov at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/97220] New: Overload resolution works wrong when implicit conversion not exists
Date: Sun, 27 Sep 2020 21:41:45 +0000	[thread overview]
Message-ID: <bug-97220-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97220

            Bug ID: 97220
           Summary: Overload resolution works wrong when implicit
                    conversion not exists
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: konstantin.vladimirov at gmail dot com
  Target Milestone: ---

Minimal reproducer is here: https://godbolt.org/z/rd4e9a

struct S {
  explicit S(int, int, int) {}
};

struct T {
  T(int, int, int) {}
};

void foo(struct S) {} // 1
void foo(struct T) {} // 2

int main() {
  S s{1, 2, 3};

  foo({1, 2, 3});
}

By C++ standard, [over.match.viable], "for F to be a viable function, there
shall exist for each argument an implicit conversion sequence (12.4.3.1) that
converts that argument to the corresponding parameter of F"

So 1 is not viable overload and resolution shall peek 2

But in reality now error produced:

error: call of overloaded 'foo(<brace-enclosed initializer list>)' is ambiguous

             reply	other threads:[~2020-09-27 21:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-27 21:41 konstantin.vladimirov at gmail dot com [this message]
2020-09-27 21:51 ` [Bug c++/97220] " mpolacek at gcc dot gnu.org
2021-12-14  5:57 ` pinskia at gcc dot gnu.org
2021-12-14 15:26 ` ppalka at gcc dot gnu.org
2022-12-03 18:52 ` pinskia at gcc dot gnu.org

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=bug-97220-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@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).