public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/107797] New: "warning right operand of comma operator has no effect" for expressions with no comma operator
@ 2022-11-21 17:41 redi at gcc dot gnu.org
  2022-11-21 17:59 ` [Bug c++/107797] " mpolacek at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: redi at gcc dot gnu.org @ 2022-11-21 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107797
           Summary: "warning right operand of comma operator has no
                    effect" for expressions with no comma operator
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

int main() {
    (long)new int{};
    long(new int{});
}

With -Wall this gives:

comma.cc: In function ‘int main()’:
comma.cc:2:20: warning: right operand of comma operator has no effect
[-Wunused-value]
    2 |     (long)new int{};
      |                    ^
comma.cc:3:20: warning: right operand of comma operator has no effect
[-Wunused-value]
    3 |     long(new int{});
      |                    ^


There is no comma operator in the code.

The bogus warning has been there since at least 6.1

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

end of thread, other threads:[~2023-01-23 21:43 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-21 17:41 [Bug c++/107797] New: "warning right operand of comma operator has no effect" for expressions with no comma operator redi at gcc dot gnu.org
2022-11-21 17:59 ` [Bug c++/107797] " mpolacek at gcc dot gnu.org
2022-11-21 18:03 ` pinskia at gcc dot gnu.org
2022-11-21 18:12 ` mpolacek at gcc dot gnu.org
2022-11-21 18:19 ` pinskia at gcc dot gnu.org
2023-01-19 19:03 ` mpolacek at gcc dot gnu.org
2023-01-23 21:42 ` cvs-commit at gcc dot gnu.org
2023-01-23 21:42 ` mpolacek at gcc dot gnu.org
2023-01-23 21:43 ` 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).