[Bug c++/91314] Confusing warning refers to nonexistent comma operator

2019-08-21 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2019-08-21
 CC||mpolacek at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Marek Polacek  ---
Confirmed.  Probably comes from genericize_compound_lvalue.

[Bug c++/91314] Confusing warning refers to nonexistent comma operator

2019-08-04 Thread egallager at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314

Eric Gallager  changed:

   What|Removed |Added

 CC||egallager at gcc dot gnu.org

--- Comment #3 from Eric Gallager  ---
(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), `) 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 
> on comp.lang.c++, 2019-07-24, thread "why can't I apply a bitwise modifier
> directly in a function call?".

[Bug c++/91314] Confusing warning refers to nonexistent comma operator

2019-08-01 Thread harald at gigawatt dot nl
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314

Harald van Dijk  changed:

   What|Removed |Added

 CC||harald at gigawatt dot nl

--- Comment #2 from Harald van Dijk  ---
(In reply to Keith Thompson from comment #0)
> I've reproduced this problem with all versions of g++ I have access
> to, from 4.1.2 to 10.0.0 20190718 (experimental).

GCC has generated a warning for this since at least GCC 2, but up to 3.3, the
warning was

  warning: value computed is not used

which is correct. In GCC 3.4, the warning changed to

  warning: right-hand operand of comma has no effect

[Bug c++/91314] Confusing warning refers to nonexistent comma operator

2019-08-01 Thread Keith.S.Thompson at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91314

--- Comment #1 from Keith Thompson  ---
Irrelevant correction: The post was in comp.lang.c, not comp.lang.c++.