Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile with clang13 due to -Werror/-Wdeprecated-copy-with-dtor #194

Closed
LtdSauce opened this issue Feb 22, 2022 · 2 comments
Closed

Comments

@LtdSauce
Copy link

Hi,

we build our software with Ubuntu Impish (21.10) and the default clang Compiler in that release (clang13). Recently we added ApprovalTests.cpp as a dependency and found out, that it does not compile because of one warning turned into an error.
We included it with cmakes FetchContent module.

Steps to reproduce

On Ubuntu Impish run the following:

$ git clone https://github.com/approvals/ApprovalTests.cpp.git
$ cd ApprovalTests.cpp
$ mkdir foo && cd foo
$ CXX=clang++ CC=clang cmake ..
$ make -j4

Produces the following output:

In file included from /tmp/ApprovalTests.cpp/ApprovalTests/writers/ExistingFile.cpp:1:
In file included from /tmp/ApprovalTests.cpp/ApprovalTests/../ApprovalTests/writers/ExistingFile.h:4:
In file included from /tmp/ApprovalTests.cpp/ApprovalTests/../ApprovalTests/core/Options.h:6:
In file included from /tmp/ApprovalTests.cpp/ApprovalTests/../ApprovalTests/namers/DefaultNamerFactory.h:3:
/tmp/ApprovalTests.cpp/ApprovalTests/../ApprovalTests/core/ApprovalNamer.h:10:17: error: definition of implicit copy constructor for 'ApprovalNamer' is deprecated because it has a user-declared destructor [-Werror,-Wdeprecated-copy-with-dtor]
        virtual ~ApprovalNamer() = default;
                ^
/tmp/ApprovalTests.cpp/ApprovalTests/../ApprovalTests/namers/ExistingFileNamer.h:9:11: note: in implicit copy constructor for 'ApprovalTests::ApprovalNamer' first required here
    class ExistingFileNamer : public ApprovalNamer
          ^
/tmp/ApprovalTests.cpp/ApprovalTests/writers/ExistingFile.cpp:58:16: note: in implicit move constructor for 'ApprovalTests::ExistingFileNamer' first required here
        return ExistingFileNamer(filePath, options_);
               ^
1 error generated.
make[2]: *** [ApprovalTests/CMakeFiles/ApprovalTests.dir/build.make:1000: ApprovalTests/CMakeFiles/ApprovalTests.dir/writers/ExistingFile.cpp.o] Fehler 1
make[2]: *** Auf noch nicht beendete Prozesse wird gewartet …
make[1]: *** [CMakeFiles/Makefile2:848: ApprovalTests/CMakeFiles/ApprovalTests.dir/all] Fehler 2
make: *** [Makefile:146: all] Fehler 2

Clang version for the record:

$ clang++ --version
Ubuntu clang version 13.0.0-2
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

Workaround

We were able to build by manually disabling -Wno-error by putting target_compile_options(ApprovalTests PRIVATE -Wno-error) after fetching it.

claremacrae added a commit that referenced this issue Feb 22, 2022
Co-Authored-By: Llewellyn Falco <llewellyn.falco@gmail.com>
claremacrae added a commit that referenced this issue Feb 22, 2022
Co-Authored-By: Llewellyn Falco <llewellyn.falco@gmail.com>
claremacrae added a commit that referenced this issue Feb 22, 2022
@claremacrae
Copy link
Collaborator

Thanks for reporting this.

We were able to reproduce the problem with this:

https://godbolt.org/z/EGbx1zM3P

And have a proposed fix.

We're hoping to release this on Friday.

@LtdSauce
Copy link
Author

Thank you for your fast response and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants