https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
--- Comment #3 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Keith Thompson from comment #0)
> 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.
Reminds me of bug 70619
>
> 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 <[email protected]>
> on comp.lang.c++, 2019-07-24, thread "why can't I apply a bitwise modifier
> directly in a function call?".