public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
@ 2020-10-15  8:56 avi@cloudius-systems.com
  2020-10-15 12:04 ` [Bug c++/97438] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: avi@cloudius-systems.com @ 2020-10-15  8:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97438
           Summary: [accepts-invalid] coroutines accepts prmomise type
                    with both return_value() and return_void()
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: avi@cloudius-systems.com
  Target Milestone: ---

The standard says:

[dcl.fct.def.coroutine]

6. The unqualified-ids return_­void and return_­value are looked up in the
scope of the promise type. If both are found, the program is ill-formed.


But gcc accepts such a promise type. Clang rejects it.

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
@ 2020-10-15 12:04 ` rguenth at gcc dot gnu.org
  2020-10-15 12:29 ` avi@cloudius-systems.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-15 12:04 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |iains at gcc dot gnu.org

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
testcase?

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
  2020-10-15 12:04 ` [Bug c++/97438] " rguenth at gcc dot gnu.org
@ 2020-10-15 12:29 ` avi@cloudius-systems.com
  2020-10-19 19:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: avi@cloudius-systems.com @ 2020-10-15 12:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Avi Kivity <avi@cloudius-systems.com> ---
Created attachment 49379
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49379&action=edit
test case

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
  2020-10-15 12:04 ` [Bug c++/97438] " rguenth at gcc dot gnu.org
  2020-10-15 12:29 ` avi@cloudius-systems.com
@ 2020-10-19 19:23 ` cvs-commit at gcc dot gnu.org
  2020-10-19 19:28 ` iains at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-10-19 19:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Iain D Sandoe <iains@gcc.gnu.org>:

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

commit r11-4076-gb003c4b14b3f889e6707db68d2c6545eda7a203b
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Oct 17 11:21:11 2020 +0100

    coroutines: Emit error for invalid promise return types [PR97438].

    At one stage, use cases were proposed for allowing the promise
    type to contain both return_value and return_void.  That was
    not accepted into C++20, so we should reject it as per the PR.

    gcc/cp/ChangeLog:

            PR c++/97438
            * coroutines.cc (struct coroutine_info): Add a field to
            record that we emitted a promise type error.
            (coro_promise_type_found_p): Check for the case that the
            promise type contains both return_void and return_value.
            Emit an error if so, with information about the wrong
            type methods.

    gcc/testsuite/ChangeLog:

            PR c++/97438
            * g++.dg/coroutines/pr97438.C: New test.

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
                   ` (2 preceding siblings ...)
  2020-10-19 19:23 ` cvs-commit at gcc dot gnu.org
@ 2020-10-19 19:28 ` iains at gcc dot gnu.org
  2020-10-20  5:43 ` avi@cloudius-systems.com
  2021-01-03  9:28 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: iains at gcc dot gnu.org @ 2020-10-19 19:28 UTC (permalink / raw)
  To: gcc-bugs

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

Iain Sandoe <iains at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Last reconfirmed|                            |2020-10-19
   Target Milestone|---                         |11.0
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
fixed on master, 
the general view is that this isn't critical to back port (if there is some
pressing reason it should be then please reopen the PR).

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
                   ` (3 preceding siblings ...)
  2020-10-19 19:28 ` iains at gcc dot gnu.org
@ 2020-10-20  5:43 ` avi@cloudius-systems.com
  2021-01-03  9:28 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: avi@cloudius-systems.com @ 2020-10-20  5:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Avi Kivity <avi@cloudius-systems.com> ---
No pressing reason to backport (for me gcc coroutines are useless anyway due to
95137)

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

* [Bug c++/97438] [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void()
  2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
                   ` (4 preceding siblings ...)
  2020-10-20  5:43 ` avi@cloudius-systems.com
@ 2021-01-03  9:28 ` cvs-commit at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-01-03  9:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Iain D Sandoe
<iains@gcc.gnu.org>:

https://gcc.gnu.org/g:4bca11333c274ab5d06677ed952afa097c7d3c78

commit r10-9197-g4bca11333c274ab5d06677ed952afa097c7d3c78
Author: Iain Sandoe <iain@sandoe.co.uk>
Date:   Sat Oct 17 11:21:11 2020 +0100

    coroutines: Emit error for invalid promise return types [PR97438].

    At one stage, use cases were proposed for allowing the promise
    type to contain both return_value and return_void.  That was
    not accepted into C++20, so we should reject it as per the PR.

    gcc/cp/ChangeLog:

            PR c++/97438
            * coroutines.cc (struct coroutine_info): Add a field to
            record that we emitted a promise type error.
            (coro_promise_type_found_p): Check for the case that the
            promise type contains both return_void and return_value.
            Emit an error if so, with information about the wrong
            type methods.

    gcc/testsuite/ChangeLog:

            PR c++/97438
            * g++.dg/coroutines/pr97438.C: New test.

    (cherry picked from commit b003c4b14b3f889e6707db68d2c6545eda7a203b)

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

end of thread, other threads:[~2021-01-03  9:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-15  8:56 [Bug c++/97438] New: [accepts-invalid] coroutines accepts prmomise type with both return_value() and return_void() avi@cloudius-systems.com
2020-10-15 12:04 ` [Bug c++/97438] " rguenth at gcc dot gnu.org
2020-10-15 12:29 ` avi@cloudius-systems.com
2020-10-19 19:23 ` cvs-commit at gcc dot gnu.org
2020-10-19 19:28 ` iains at gcc dot gnu.org
2020-10-20  5:43 ` avi@cloudius-systems.com
2021-01-03  9:28 ` 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).