public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96749] New: [coroutines] unexpected 'warning: statement has no effect [-Wunused-value]'
@ 2020-08-23  5:57 bazhenov.dn at gmail dot com
  2020-08-23  5:59 ` [Bug c++/96749] " bazhenov.dn at gmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: bazhenov.dn at gmail dot com @ 2020-08-23  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96749
           Summary: [coroutines] unexpected 'warning: statement has no
                    effect [-Wunused-value]'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: bazhenov.dn at gmail dot com
  Target Milestone: ---

C++ compiler throws unexpected 'statement with no effect' warning at the ending
brace of a coroutine function when it utilizes co_await expression returning
non-void value which is used as an rvalue within operators '+=', '-=', '*=',
etc.

The warning doesn't appear if the co_await expression is used as an rvalue
within simple assignment ('=') to a temporary variable and then the latter used
within '+=' or other operation.

The attached test code is composed to reveal the issue but is not meant to do
any job. The "#if" alternative in the code can be used to show how warning
disappears.
In a case of meaningful code which causes the warning the code works as
expected.

- g++ version:
  g++ (GCC) 11.0.0 20200822 (experimental)
- configure pameters:
  configure --disable-multilib
- system:
  Linux beauty 5.4.0-42-generic #46-Ubuntu SMP Fri Jul 10 00:24:02 UTC 2020
x86_64 x86_64 x86_64 GNU/Linux
- compiler command:
  g++ -std=c++20 -O0 -g -Wall -fcoroutines -o test test.cpp

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

end of thread, other threads:[~2021-03-24 12:38 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23  5:57 [Bug c++/96749] New: [coroutines] unexpected 'warning: statement has no effect [-Wunused-value]' bazhenov.dn at gmail dot com
2020-08-23  5:59 ` [Bug c++/96749] " bazhenov.dn at gmail dot com
2020-12-04 14:13 ` max at duempel dot org
2021-03-04 20:38 ` iains at gcc dot gnu.org
2021-03-12 15:36 ` iains at gcc dot gnu.org
2021-03-15 15:49 ` cvs-commit at gcc dot gnu.org
2021-03-22 22:04 ` cvs-commit at gcc dot gnu.org
2021-03-24 12:38 ` iains 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).