[Bug c++/56289] Bad location for unused value warning with comma operator

2023-09-07 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289

--- Comment #6 from Jonathan Wakely  ---
(In reply to Gayathri Gottumukkala from comment #5)
> We cannot cast the two variables in single line using void.

That's not what the code is trying to do.

> Instead of that
> we have to use void for two variables separately.

Saying "if you don't write the code that triggers the bug, it doesn't trigger
the bug" is not very useful.

[Bug c++/56289] Bad location for unused value warning with comma operator

2023-09-06 Thread gayathri.gottumukkala.27 at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289

Gayathri Gottumukkala  changed:

   What|Removed |Added

 CC||gayathri.gottumukkala.27@gm
   ||ail.com

--- Comment #5 from Gayathri Gottumukkala  ---
We cannot cast the two variables in single line using void. Instead of that we
have to use void for two variables separately.

[Bug c++/56289] Bad location for unused value warning with comma operator

2013-04-19 Thread manu at gcc dot gnu.org

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56289

Manuel López-Ibáñez manu at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2013-04-19
 CC||manu at gcc dot gnu.org
Summary|Bad unused value warning|Bad location for unused
   |with comma operator |value warning with comma
   ||operator
 Ever Confirmed|0   |1

--- Comment #4 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-04-19 
16:49:44 UTC ---
The location could be better but it is pretty close for C++:

test.c:4:14: warning: right operand of comma operator has no effect
[-Wunused-value]
   (void) x, y; /* warning: right operand of comma operator has no effect
  ^

But the C FE is pretty awful:

test.c:4:3: warning: statement with no effect [-Wunused-value]
   (void) x, y; /* warning: right operand of comma operator has no effect
   ^

Clang:

test.c:4:13: warning: expression result unused [-Wunused-value]
  (void) x, y; /* warning: right operand of comma operator has no effect
^