public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102691] New: rvalue reference overload in not preferred over lvalue reference
@ 2021-10-11 21:22 fchelnokov at gmail dot com
  2021-10-12 13:40 ` [Bug c++/102691] " ppalka at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: fchelnokov at gmail dot com @ 2021-10-11 21:22 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102691
           Summary: rvalue reference overload in not preferred over lvalue
                    reference
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

This code is valid:
```
struct Foo {};
struct Bar {};

constexpr int Baz(const Foo&) { return 0; }
constexpr int Baz(Bar&&) { return 1; }

int main()
{
  static_assert( Baz({}) == 1 );
}
```
Here Baz(Bar&&) must be preferred according to [over.ics.rank]/(3.2), as Clang
does.

Unfortunately, GCC wrongly prints ambiguity error, demo:
https://gcc.godbolt.org/z/7Yq8hdcso

Related discussion: https://stackoverflow.com/q/62599846/7325599

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

* [Bug c++/102691] rvalue reference overload in not preferred over lvalue reference
  2021-10-11 21:22 [Bug c++/102691] New: rvalue reference overload in not preferred over lvalue reference fchelnokov at gmail dot com
@ 2021-10-12 13:40 ` ppalka at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-10-12 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Dup of PR102283 (will respond there)

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

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

end of thread, other threads:[~2021-10-12 13:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-11 21:22 [Bug c++/102691] New: rvalue reference overload in not preferred over lvalue reference fchelnokov at gmail dot com
2021-10-12 13:40 ` [Bug c++/102691] " ppalka 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).