Why am I permitted to declare an object with a deleted destructor?

前端 未结 4 1386
甜味超标
甜味超标 2021-01-01 13:59

Consider the following text:

[C++11: 12.4/11]: Destructors are invoked implicitly

  • for constructed objects with static
4条回答
  •  天命终不由人
    2021-01-01 14:48

    It's that B's destructor is generated by the compiler at the line of your error and it has a call to A's destructor which is deleted, hence the error. In the first example nothing is trying to call A's destructor hence no error.

提交回复
热议问题