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

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

Closed
tybl opened this issue Oct 10, 2016 · 4 comments
Closed

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

tybl opened this issue Oct 10, 2016 · 4 comments

Comments

@tybl
Copy link

tybl 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
Copy link
Member

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?

@tybl
Copy link
Author

tybl 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
Copy link
Member

onqtam commented Oct 10, 2016

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 clang warns about deprecated implicit copy constructors clang warnings when using C++11 or newer Oct 10, 2016
@onqtam
Copy link
Member

onqtam commented Oct 10, 2016

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

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