[Bug c++/83028] Incorrect -Wsequence-point warning in correct C++17 code with new evaluation order rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028 --- Comment #5 from Jonathan Wakely --- Yes, obviously, because separate statements have a sequence point between them.
[Bug c++/83028] Incorrect -Wsequence-point warning in correct C++17 code with new evaluation order rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028 Gayathri Gottumukkala changed: What|Removed |Added CC||gayathri.gottumukkala.27@gm ||ail.com --- Comment #4 from Gayathri Gottumukkala --- The code gives warning if we use different flags while compiling. If we give individual print statements instead of one single statement, then there will be no warnings and it is compiled successfully.
[Bug c++/83028] Incorrect -Wsequence-point warning in correct C++17 code with new evaluation order rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028 Rafael Avila de Espindola changed: What|Removed |Added CC||rafael at espindo dot la --- Comment #3 from Rafael Avila de Espindola --- We just hit this and incorrectly assumed our codebase had a bug. It would be really nice for this warning to take -std=XX into consideration and not warn for code that is now valid.
[Bug c++/83028] Incorrect -Wsequence-point warning in correct C++17 code with new evaluation order rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org Last reconfirmed||2020-04-13 Status|UNCONFIRMED |NEW Ever confirmed|0 |1 --- Comment #2 from Martin Sebor --- Confirmed. Unless the C++ 2a standard defines behavior in all cases issuing the warning for both valid (in C++ 2a) and invalid code code on the bases that it's invalid in some other standard or language, and without distinguishing between the valid uses from the invalid ones, would make the warning meaningless. At a minimum, the warning should be split into two: one for portability to other standards/languages, and another for problems in C++ 2a.
[Bug c++/83028] Incorrect -Wsequence-point warning in correct C++17 code with new evaluation order rules
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83028 Matthijs van Duin changed: What|Removed |Added CC||matthijsvanduin at gmail dot com --- Comment #1 from Matthijs van Duin --- There are many such cases which are well-defined in C++17 yet trigger a sequence-point warning in g++ 8.2, such as: (x+i)[i++] i = i++ (funcs[i++])(i) This incorrect behaviour is actually documented: "The C++17 standard will define the order of evaluation of operands in more cases: in particular it requires that the right-hand side of an assignment be evaluated before the left-hand side, so the above examples are no longer undefined. But this warning will still warn about them, to help people avoid writing code that is undefined in C and earlier revisions of C++." This reasoning here is of course complete garbage. Plenty of valid C++17 code is invalid in earlier revisions of the standard. When compiling code with -std=c++17 or -std=gnu++17, the compiler should only concern itself with whether the code is valid C++17 code. Since I think habitually ignoring warnings is very bad practice and compile with -Werror to ensure this won't happen, I consider these warnings to be nearly as bad as miscompilation, as the end result is the same: I still cannot rely on this feature of the C++17 standard.