public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97220] New: Overload resolution works wrong when implicit conversion not exists
@ 2020-09-27 21:41 konstantin.vladimirov at gmail dot com
  2020-09-27 21:51 ` [Bug c++/97220] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: konstantin.vladimirov at gmail dot com @ 2020-09-27 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

end of thread, other threads:[~2022-12-03 18:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-27 21:41 [Bug c++/97220] New: Overload resolution works wrong when implicit conversion not exists konstantin.vladimirov at gmail dot com
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

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