https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65866
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2015-04-23 00:00:00 |2021-11-3
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
>From PR 70792:
#include <iostream>
struct MyType {
MyType(int i, int j, int k, int l)
: sum(i + j + k + l)
{
}
int sum;
};
int main()
{
int i = 0;
std::cout << MyType{ ++i, ++i, ++i, ++i }.sum << '\n';
}
70792.C: In function 'int main()':
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]
16 | std::cout << MyType{ ++i, ++i, ++i, ++i }.sum << '\n';
| ^~~
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]
70792.C:16:24: warning: operation on 'i' may be undefined [-Wsequence-point]