Skip to content

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

@LtdSauce

Description

@LtdSauce

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions