public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/100894] New: The std::common_reference implementation seems to be wrong
@ 2021-06-03 16:35 hewillk at gmail dot com
  2021-06-14 17:25 ` [Bug libstdc++/100894] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2021-06-03 16:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100894
           Summary: The std::common_reference implementation seems to be
                    wrong
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

In [meta#trans.other-6.3.1], the standard specifies "If T1 and T2 are reference
types and COMMON-REF(T1, T2) is well-formed, then the member typedef type
denotes that type", where COMMON-REF is defined in [meta#trans.other-3.5]: "If
A and B are both lvalue reference types, COMMON-REF(A, B) is COND-RES(COPYCV(X,
Y) &, COPYCV(​ Y, X) &) if that type exists and is a reference type."

libstdc++ does not check that COMMON-REF(A, B) must be a reference type, which
will lead to incorrect determination of the common reference type according to
bullet 1 in the following cases.

https://godbolt.org/z/7Mc7jjesK

#include <concepts>

struct A {};
struct B { B(A); };
static_assert(
  std::same_as<
  std::common_reference_t<A&, B&&>, B>);

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

end of thread, other threads:[~2021-08-10 16:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03 16:35 [Bug libstdc++/100894] New: The std::common_reference implementation seems to be wrong hewillk at gmail dot com
2021-06-14 17:25 ` [Bug libstdc++/100894] " redi at gcc dot gnu.org
2021-06-14 19:30 ` redi at gcc dot gnu.org
2021-06-14 20:17 ` cvs-commit at gcc dot gnu.org
2021-06-14 21:49 ` cvs-commit at gcc dot gnu.org
2021-08-10 16:07 ` cvs-commit at gcc dot gnu.org
2021-08-10 16:07 ` redi 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).