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

* [Bug c++/97220] Overload resolution works wrong when implicit conversion not exists
  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 ` mpolacek at gcc dot gnu.org
  2021-12-14  5:57 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-09-27 21:51 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-09-27

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/97220] Overload resolution works wrong when implicit conversion not exists
  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
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ldionne.2 at gmail dot com

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102247 has been marked as a duplicate of this bug. ***

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

* [Bug c++/97220] Overload resolution works wrong when implicit conversion not exists
  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
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-12-14 15:26 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
GCC is behaving correctly here as pointed out by Tim at
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102247#c2

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

* [Bug c++/97220] Overload resolution works wrong when implicit conversion not exists
  2020-09-27 21:41 [Bug c++/97220] New: Overload resolution works wrong when implicit conversion not exists konstantin.vladimirov at gmail dot com
                   ` (2 preceding siblings ...)
  2021-12-14 15:26 ` ppalka at gcc dot gnu.org
@ 2022-12-03 18:52 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-03 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |DUPLICATE

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 60027.

*** This bug has been marked as a duplicate of bug 60027 ***

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