https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91224
Bug ID: 91224
Summary: -Wsequence-point claims a defined value is undefined
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: john.boyer at tutanota dot com
Target Milestone: ---
The following code:
int value = (value = 5, ++value);
Will produce the following warning:
<source>: In function 'void __static_initialization_and_destruction_0(int,
int)':
<source>:5:25: warning: operation on 'value' may be undefined
[-Wsequence-point]
5 | int value = (value = 5, ++value);
| ^~~~~~~
Even though value is initialized before it is incremented, the warning is still
displayed: https://godbolt.org/z/AjgNod.