approvals / ApprovalTests.cpp

Native ApprovalTests for C++ on Linux, Mac and Windows
https://approvaltestscpp.readthedocs.io/en/latest/
Apache License 2.0
312 stars 51 forks source link

Fix -Wdeprecated-copy-dtor warnings (#163) #164

Closed nlohmann closed 3 years ago

nlohmann commented 3 years ago

Description

The PR fixes a few Wdeprecated-copy-dtor warnings which are raised by Clang 11.

The solution

The compiler complains that the definition of an implicit copy constructor is deprecated when the class has a user-declared destructor. This PR adds default copy constructors to all classes where the warning occurs.

Fixes #163

nlohmann commented 3 years ago
claremacrae commented 3 years ago

Thanks very much!

  • I ran clang-format locally and have no idea why the CI complains.
  • I am not using Windows, so I cannot debug the failed Windows jobs.

Sorry, these were both happening before your change - due to the afore-mentioned "too much stuff in flight", temporarily...

claremacrae commented 3 years ago

For my own education, and to test my Mac build using Clang 11, I'm trying to reproduce this error before accepting the pull request...

I've confirmed that warnings are treated as errors, by adding an unused variable to one of the .cpp files in the ApprovalTests.cpp libraries - but I'm just not seeing these warnings/errors.

Ah - I had to add -Wdeprecated-copy-dtor to CMake/WarningsAsErrors.cmake to turn the warning on.

nlohmann commented 3 years ago

Thanks a lot for the quick merging.