public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void
@ 2022-08-12  3:27 hewillk at gmail dot com
  2022-08-12  3:34 ` [Bug libstdc++/106589] " hewillk at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2022-08-12  3:27 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106589
           Summary: visit<void> rejects lambdas that do not return void
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include <variant>

int main() {
  std::visit<void>([]{ return 0; });
}

https://godbolt.org/z/G3Penchbx

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

* [Bug libstdc++/106589] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
@ 2022-08-12  3:34 ` hewillk at gmail dot com
  2022-08-12  6:04 ` [Bug libstdc++/106589] [12/13 Regression] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: hewillk at gmail dot com @ 2022-08-12  3:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from 康桓瑋 <hewillk at gmail dot com> ---
variant#L1730:

  if constexpr (sizeof...(_Variants) == 0)
        return std::forward<_Visitor>(__visitor)();

In this branch, we seem to need to detect if _Result_type is void and
explicitly cast the return type to void.

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

* [Bug libstdc++/106589] [12/13 Regression] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
  2022-08-12  3:34 ` [Bug libstdc++/106589] " hewillk at gmail dot com
@ 2022-08-12  6:04 ` pinskia at gcc dot gnu.org
  2022-08-12  6:09 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-12  6:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|visit<void> rejects lambdas |[12/13 Regression]
                   |that do not return void     |visit<void> rejects lambdas
                   |                            |that do not return void
      Known to work|                            |11.3.0
   Target Milestone|---                         |12.2
      Known to fail|                            |12.1.0

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

* [Bug libstdc++/106589] [12/13 Regression] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
  2022-08-12  3:34 ` [Bug libstdc++/106589] " hewillk at gmail dot com
  2022-08-12  6:04 ` [Bug libstdc++/106589] [12/13 Regression] " pinskia at gcc dot gnu.org
@ 2022-08-12  6:09 ` pinskia at gcc dot gnu.org
  2022-08-12 22:00 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-08-12  6:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2022-08-12
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. A regression from GCC 11.3.0.

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

* [Bug libstdc++/106589] [12/13 Regression] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
                   ` (2 preceding siblings ...)
  2022-08-12  6:09 ` pinskia at gcc dot gnu.org
@ 2022-08-12 22:00 ` redi at gcc dot gnu.org
  2022-08-24 13:01 ` [Bug libstdc++/106589] [12 " cvs-commit at gcc dot gnu.org
  2022-08-24 13:02 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-12 22:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I haven't checked, but it's probably g:cfb582f62791dfadc243d97d37f0b83ef77cf480

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

* [Bug libstdc++/106589] [12 Regression] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
                   ` (3 preceding siblings ...)
  2022-08-12 22:00 ` redi at gcc dot gnu.org
@ 2022-08-24 13:01 ` cvs-commit at gcc dot gnu.org
  2022-08-24 13:02 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-08-24 13:01 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:219d9f61a241d370b7933aecae56ce0905465830

commit r12-8711-g219d9f61a241d370b7933aecae56ce0905465830
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 23 15:46:16 2022 +0100

    libstdc++: Fix visit<void>(v) for non-void visitors [PR106589]

    The optimization for the common case of std::visit forgot to handle the
    edge case of passing zero variants to a non-void visitor and converting
    the result to void.

    libstdc++-v3/ChangeLog:

            PR libstdc++/106589
            * include/std/variant (__do_visit): Handle is_void<R> for zero
            argument case.
            * testsuite/20_util/variant/visit_r.cc: Check std::visit<void>(v).

    (cherry picked from commit e85bb1881e57e53306ede2a15f30d06480d69886)

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

* [Bug libstdc++/106589] [12 Regression] visit<void> rejects lambdas that do not return void
  2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
                   ` (4 preceding siblings ...)
  2022-08-24 13:01 ` [Bug libstdc++/106589] [12 " cvs-commit at gcc dot gnu.org
@ 2022-08-24 13:02 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2022-08-24 13:02 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 12.3, thanks for the report.

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

end of thread, other threads:[~2022-08-24 13:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-12  3:27 [Bug libstdc++/106589] New: visit<void> rejects lambdas that do not return void hewillk at gmail dot com
2022-08-12  3:34 ` [Bug libstdc++/106589] " hewillk at gmail dot com
2022-08-12  6:04 ` [Bug libstdc++/106589] [12/13 Regression] " pinskia at gcc dot gnu.org
2022-08-12  6:09 ` pinskia at gcc dot gnu.org
2022-08-12 22:00 ` redi at gcc dot gnu.org
2022-08-24 13:01 ` [Bug libstdc++/106589] [12 " cvs-commit at gcc dot gnu.org
2022-08-24 13:02 ` 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).