https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115160
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- This is just bogus testcase, anything can happen. If you use unsigned char data[] = { 1, 0, 0, 0 }, *b = data; instead of the std::vector<uint8_t> data; data.emplace_back(1); data.emplace_back(0); data.emplace_back(0); data.emplace_back(0); auto b = data.begin(); lines, g++ -Wall diagnoses it: pr115160.C: In function ‘int main()’: pr115160.C:12:50: warning: operation on ‘b’ may be undefined [-Wsequence-point] 12 | std::cout << (int)( (*b++) | (*b++ << 8) | (*b++ << 16 ) | ( *b << 24 ) )<< std::endl; | ~^~ pr115160.C:12:50: warning: operation on ‘b’ may be undefined [-Wsequence-point] pr115160.C:12:50: warning: operation on ‘b’ may be undefined [-Wsequence-point] pr115160.C:12:50: warning: operation on ‘b’ may be undefined [-Wsequence-point] While https://wg21.link/p0145r3 in C++17 made evaluation order in some cases well defined, it certainly didn't do that for non-overloaded operator| or similar operators.