int main(){
int i = i;
return i;
}
There are similar questions, but no answer. Maybe I've not searched well enough.
Why the standard doesn't prohibit such expressions? What could possibly be the reason? The expression clearly doesn't make any sense.
Conclusion:
int i = (i=1) + 1;
is a valid expression with a defined behavior.
The example of a recursive lambda with the help of std::function
is also a very valid use.
Thus, such expressions should not be prohibited because it would be unwise to oblige the compiler to do the analysis(though any decent compiler does it)