public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109323] New: No error when neither of return_value or return_void is defined
@ 2023-03-28 21:52 enricomaria.dean6elis at gmail dot com
  2023-03-28 21:56 ` [Bug c++/109323] " pinskia at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2023-03-28 21:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109323
           Summary: No error when neither of return_value or return_void
                    is defined
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: enricomaria.dean6elis at gmail dot com
  Target Milestone: ---

Repro:

1. take the example here ->
https://en.cppreference.com/w/cpp/language/coroutines
2. remove the 3 `if (cond) co_return;` from `fibonacci_sequence`
3. remove `return_void` from `promise_type`
4. compile

Alternatively: https://godbolt.org/z/v3xd3b7TE, where both GCC and Clang
erroneously accept the code, whereas MSVC correcly rejects it.
(http://eel.is/c++draft/dcl.fct.def.coroutine#6)

I'm aware of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95517, but that makes
no reference to the fact that not declaring any of the two functions is
erroneous.

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
@ 2023-03-28 21:56 ` pinskia at gcc dot gnu.org
  2023-03-30 17:49 ` enricomaria.dean6elis at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-28 21:56 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-03-28
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |WAITING

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Can you attach the testcase on what exactly you think is wrong instead of just
links to other sources?

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
  2023-03-28 21:56 ` [Bug c++/109323] " pinskia at gcc dot gnu.org
@ 2023-03-30 17:49 ` enricomaria.dean6elis at gmail dot com
  2023-03-30 18:11 ` enricomaria.dean6elis at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2023-03-30 17:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Enrico Maria De Angelis <enricomaria.dean6elis at gmail dot com> ---
Created attachment 54790
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54790&action=edit
Attachment for report 109323

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
  2023-03-28 21:56 ` [Bug c++/109323] " pinskia at gcc dot gnu.org
  2023-03-30 17:49 ` enricomaria.dean6elis at gmail dot com
@ 2023-03-30 18:11 ` enricomaria.dean6elis at gmail dot com
  2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2023-03-30 18:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Enrico Maria De Angelis <enricomaria.dean6elis at gmail dot com> ---
However, I'm not entirely sure (not anymore now that I've read the standard
more carefully) that not having any of those two memebrs is an error.

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
                   ` (2 preceding siblings ...)
  2023-03-30 18:11 ` enricomaria.dean6elis at gmail dot com
@ 2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
  2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
  2024-04-13  2:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2023-03-30 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Enrico Maria De Angelis <enricomaria.dean6elis at gmail dot com> ---
The more I read the standard, specifically
http://eel.is/c++draft/dcl.fct.def.coroutine#6 and
http://eel.is/c++draft/stmt.return.coroutine, the more I'm convinced that it's
just fine that a coroutine's promise_type lacks both return_void and
return_value, as long as it has no co_return and the execution never flows off
the end of the coroutine itself.

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
                   ` (3 preceding siblings ...)
  2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
@ 2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
  2024-04-13  2:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: enricomaria.dean6elis at gmail dot com @ 2023-03-30 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Enrico Maria De Angelis <enricomaria.dean6elis at gmail dot com> ---
I've asked some feeback here
https://stackoverflow.com/questions/75891694/is-it-legal-for-a-coroutines-promise-type-to-lack-both-return-void-and-return-v

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

* [Bug c++/109323] No error when neither of return_value or return_void is defined
  2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
                   ` (4 preceding siblings ...)
  2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
@ 2024-04-13  2:05 ` pinskia at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-13  2:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|1                           |0
             Status|WAITING                     |UNCONFIRMED

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

end of thread, other threads:[~2024-04-13  2:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 21:52 [Bug c++/109323] New: No error when neither of return_value or return_void is defined enricomaria.dean6elis at gmail dot com
2023-03-28 21:56 ` [Bug c++/109323] " pinskia at gcc dot gnu.org
2023-03-30 17:49 ` enricomaria.dean6elis at gmail dot com
2023-03-30 18:11 ` enricomaria.dean6elis at gmail dot com
2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
2023-03-30 23:07 ` enricomaria.dean6elis at gmail dot com
2024-04-13  2:05 ` 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).