[libcxx-commits] [PATCH] D76150: Fix -Wdeprecated-copy-dtor and -Wdeprecated-dynamic-exception-spec warnings.

Dimitry Andric via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 13 11:50:07 PDT 2020


dim created this revision.
dim added reviewers: EricWF, mclow.lists, ldionne.
Herald added a subscriber: dexonsmith.
Herald added a project: libc++.
Herald added a reviewer: libc++.
dim added a comment.

Note: one thing that I am unsure about is the `_NOEXCEPT` after some of the copy constructors.  I only applied those to classes that have other `_NOEXCEPT` constructors, but copying may involve other things that could throw.

Maybe it is safer to not use `_NOEXCEPT` at all for all of them, instead?


The former are like:

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();
        ^

Fix these by adding an explicitly defaulted copy constructor.

The latter are like:

libcxx/include/codecvt:105:37: warning: dynamic exception specifications are deprecated [-Wdeprecated-dynamic-exception-spec]

  virtual int do_encoding() const throw();
                                  ^~~~~~~

Fix these by using the _NOEXCEPT macro instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D76150

Files:
  libcxx/include/codecvt
  libcxx/include/exception
  libcxx/include/filesystem
  libcxx/include/future
  libcxx/include/ios
  libcxx/include/memory
  libcxx/include/regex
  libcxx/include/stdexcept
  libcxx/include/system_error
  libcxx/include/typeinfo

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D76150.250268.patch
Type: text/x-patch
Size: 16442 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200313/1581de16/attachment-0001.bin>


More information about the libcxx-commits mailing list