https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314
Bug ID: 91314 Summary: Confusing warning refers to nonexistent comma operator Product: gcc Version: 9.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Keith.S.Thompson at gmail dot com Target Milestone: --- Test case: int main() { int a; &(a=0); } Demonstration: $ g++ -c -Wunused-value confusing_warning.cpp confusing_warning.cpp: In function ‘int main()’: confusing_warning.cpp:3:7: warning: right operand of comma operator has no effect [-Wunused-value] 3 | &(a=0); | ^ The problem: The warning refers to a comma operator that does not exist in the source. Speculation (please ignore this if it's not useful): The compiler internally generates some internal data structure that's similar to a comma operator (something like `(a=0), &a`) and the warning message is based on that. I've reproduced this problem with all versions of g++ I have access to, from 4.1.2 to 10.0.0 20190718 (experimental). This problem was originally reported by Stefan Ram <r...@zedat.fu-berlin.de> on comp.lang.c++, 2019-07-24, thread "why can't I apply a bitwise modifier directly in a function call?".