clang warnings when using C++11 or newer #42

Closed
tblyons opened this Issue Oct 10, 2016 · 4 comments

Projects

None yet

2 participants

@tblyons
tblyons commented Oct 10, 2016

Clang complains about Result and Subcase requiring implicit copy constructors when they have user defined destructors (deprecated in C++11).
doctest/doctest.h:727:9: warning: definition of implicit copy constructor for 'Result' is deprecated because it has a user-declared destructor [-Wdeprecated]
...
doctest/doctest.h:847:89: note: implicit copy constructor for 'Result' first required here template <typename R> Result operator==(const DOCTEST_REF_WRAP(R) rhs) { return Result(lhs == rhs, stringifyBinaryExpr(lhs, " == ", rhs)); }

doctest/doctest.h:2312:14: warning: definition of implicit copy constructor for 'Subcase' is deprecated because it has a user-declared destructor [-Wdeprecated] ...
This one was caused by pushing a Subcase onto a vector (line 2303).

@onqtam
Owner
onqtam commented Oct 10, 2016

strange - which clang compiler (version) are you using? Which OS? on travis I build all the examples with -Weverything -Werror -std=c++98 -pedantic with clang 3.4/3.5/3.6/3.7/3.8

Are you using - c++11?

Can you give me a minimal sample program that reproduces the warning?

@tblyons
tblyons commented Oct 10, 2016

I am using c++14 and have also seen it with c++11.

The factorial example in the tutorial will report the warning if compiled with -Weverything -std=c++11

It will also give -Wc++98-compat-pedantic warnings for long long, nullptr, and static_assert, but I typically compile with that warning disabled.

$ clang --version
clang version 3.8.1 (tags/RELEASE_381/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

I also see the warnings with clang on the Mac which is at Apple version 8.0.0

@onqtam
Owner
onqtam commented Oct 10, 2016 edited

I indeed reproduced this - as can be seen here

Changing to c++98 removes these errors. I will investigate. Thanks for the report!

EDIT: updated permalink to wandbox compiler

@onqtam onqtam changed the title from clang warns about deprecated implicit copy constructors to clang warnings when using C++11 or newer Oct 10, 2016
@onqtam
Owner
onqtam commented Oct 10, 2016 edited

I had tested for warnings with C++11/14 only with GCC... should have tried with clang as well. Perhaps I should add c++11 builds on the CI as well. See my related stack overflow question

@onqtam onqtam closed this in 5cab8e9 Oct 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment