Assert that code does NOT compile

后端 未结 6 943
长发绾君心
长发绾君心 2020-12-03 04:54

In short:

How to write a test, that checks that my class is not copyable or copy-assignable, but is only moveable and move-assignable?

6条回答
  •  遥遥无期
    2020-12-03 05:48

    If the goal is to ensure that the code won't compile, you can't have it as part of your test program, since otherwise, your test program won't compile. You have to invoke the compiler on it, and see what the return code is.

提交回复
热议问题