In very recent clang's -Wdeprecated-copy trips on a deprecated usage here
preventing most C++ code from compiling without NO_WERROR.
Details
- Reviewers
dim jhb eric_efcs.ca - Commits
- rS359087: Merge commit 585a3cc31 from llvm git (by me):
Diff Detail
- Repository
- rS FreeBSD src repository - subversion
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
What is an example of the warning? Normally people don't have -Wsystem-headers turned on, so I would rather see that upstream somehow fixes the warning, instead of squelching it with a custom patch (which is another diff against upstream to carry). Adding @eric_efcs.ca to see if he's still alive on this Phabricator instance..
Hmm, I wonder how you are generating these warnings, since they do not show up with -Wall -Wextra, even. I have to explicitly pass -Wdeprecated and -Wsystem-headers, then I get (even with the latest master libcxx):
In file included from test-bitset.cpp:1: In file included from libcxx/include/bitset:116: In file included from libcxx/include/__bit_reference:15: In file included from libcxx/include/algorithm:643: In file included from libcxx/include/memory:660: libcxx/include/typeinfo:322:11: warning: definition of implicit copy constructor for 'bad_cast' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~bad_cast() _NOEXCEPT; ^ libcxx/include/typeinfo:344:11: note: in implicit copy constructor for 'std::bad_cast' first required here throw bad_cast(); ^ In file included from test-bitset.cpp:1: In file included from libcxx/include/bitset:116: In file included from libcxx/include/__bit_reference:15: In file included from libcxx/include/algorithm:643: In file included from libcxx/include/memory:660: In file included from libcxx/include/typeinfo:60: libcxx/include/exception:101:13: warning: definition of implicit copy constructor for 'exception' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~exception() _NOEXCEPT; ^ libcxx/include/typeinfo:317:29: note: in implicit copy constructor for 'std::exception' first required here class _LIBCPP_EXCEPTION_ABI bad_cast ^ libcxx/include/typeinfo:344:11: note: in implicit copy constructor for 'std::bad_cast' first required here throw bad_cast(); ^
and a bunch of similar ones in <stdexcept>:
In file included from test-bitset.cpp:1: In file included from libcxx/include/bitset:116: In file included from libcxx/include/__bit_reference:15: In file included from libcxx/include/algorithm:643: In file included from libcxx/include/memory:670: libcxx/include/stdexcept:132:13: warning: definition of implicit copy constructor for 'domain_error' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~domain_error() _NOEXCEPT; ^ libcxx/include/stdexcept:229:11: note: in implicit copy constructor for 'std::domain_error' first required here throw domain_error(__msg); ^ libcxx/include/stdexcept:144:13: warning: definition of implicit copy constructor for 'invalid_argument' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~invalid_argument() _NOEXCEPT; ^ libcxx/include/stdexcept:240:11: note: in implicit copy constructor for 'std::invalid_argument' first required here throw invalid_argument(__msg); ^ libcxx/include/stdexcept:155:13: warning: definition of implicit copy constructor for 'length_error' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~length_error() _NOEXCEPT; ^ libcxx/include/stdexcept:251:11: note: in implicit copy constructor for 'std::length_error' first required here throw length_error(__msg); ^ libcxx/include/stdexcept:167:13: warning: definition of implicit copy constructor for 'out_of_range' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~out_of_range() _NOEXCEPT; ^ libcxx/include/stdexcept:262:11: note: in implicit copy constructor for 'std::out_of_range' first required here throw out_of_range(__msg); ^ libcxx/include/stdexcept:179:13: warning: definition of implicit copy constructor for 'range_error' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~range_error() _NOEXCEPT; ^ libcxx/include/stdexcept:273:11: note: in implicit copy constructor for 'std::range_error' first required here throw range_error(__msg); ^ libcxx/include/stdexcept:191:13: warning: definition of implicit copy constructor for 'overflow_error' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~overflow_error() _NOEXCEPT; ^ libcxx/include/stdexcept:284:11: note: in implicit copy constructor for 'std::overflow_error' first required here throw overflow_error(__msg); ^ libcxx/include/stdexcept:203:13: warning: definition of implicit copy constructor for 'underflow_error' is deprecated because it has a user-declared destructor [-Wdeprecated-copy-dtor] virtual ~underflow_error() _NOEXCEPT; ^ libcxx/include/stdexcept:295:11: note: in implicit copy constructor for 'std::underflow_error' first required here throw underflow_error(__msg); ^
In libc++ there are already macros called _LIBCPP_SUPPRESS_DEPRECATED_PUSH and _LIBCPP_SUPPRESS_DEPRECATED_POP to selectively disable these warnings for parts of the headers, but ideally the required copy constructors should just be declared with = default, I think.
I've submitted https://reviews.llvm.org/D76150 upstream, which is hopefully a better way to get rid of these warnings.
I saw these using a tip of tree llvm as a cross toolchain to build FreeBSD. Anything with WARNS>0 includes -Wsystem-headers and so C++ programs failed to compile.
Committed https://github.com/llvm/llvm-project/commit/585a3cc31bb49f2a526dcb74dc9a980379193f93 upstream, I'll wait for a little while to see if this triggers any issues there. If not, I will import it and this review can be abandoned.