Calling copy constructor on yourself

帅比萌擦擦* 提交于 2019-12-01 22:20:37

Since you have a member variable of type int, whose indeterminate value is copied to itself, the code is technically Undefined Behavior.

However, in practice, with current computers nothing bad will happen. But on the third hand, nothing good happens either.

Regarding warnings, that's a Quality Of Implementation issue. The C++ standard has nothing to say about that.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!