public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/115145] New: Help lambda in rewritten std::variant comparisons does not specify return type
@ 2024-05-18  6:29 hewillk at gmail dot com
  2024-05-22  9:03 ` [Bug libstdc++/115145] " cvs-commit at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hewillk at gmail dot com @ 2024-05-18  6:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 115145
           Summary: Help lambda in rewritten std::variant comparisons does
                    not specify return type
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

..which can be an regression:

#include <variant>

struct Bool {
  operator bool();
  Bool(const Bool&) = delete;
};

struct Elem {
  Bool& operator==(const Elem&) const;
};

int main() {
  std::variant<Elem> v;
  return v == v;
}

https://godbolt.org/z/14q14TrYW

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

* [Bug libstdc++/115145] Help lambda in rewritten std::variant comparisons does not specify return type
  2024-05-18  6:29 [Bug libstdc++/115145] New: Help lambda in rewritten std::variant comparisons does not specify return type hewillk at gmail dot com
@ 2024-05-22  9:03 ` cvs-commit at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-22  9:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:b33f44ca6ce2dae7502ce138600e1631ffc9232c

commit r15-769-gb33f44ca6ce2dae7502ce138600e1631ffc9232c
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue May 21 15:13:01 2024 +0100

    libstdc++: Ensure std::variant relops convert to bool [PR115145]

    Ensure that the result of comparing the variant alternatives is
    converted to bool immediately rather than copied.

    libstdc++-v3/ChangeLog:

            PR libstdc++/115145
            * include/std/variant (operator==, operator!=, operator<)
            (operator<=, operator>, operator>=): Add trailing-return-type to
            lambda expressions to trigger conversion to bool.
            * testsuite/20_util/variant/relops/115145.cc: New test.

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

end of thread, other threads:[~2024-05-22  9:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-18  6:29 [Bug libstdc++/115145] New: Help lambda in rewritten std::variant comparisons does not specify return type hewillk at gmail dot com
2024-05-22  9:03 ` [Bug libstdc++/115145] " cvs-commit 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).