Fix -Wdeprecated-copy-dtor and -Wdeprecated-dynamic-exception-spec warnings.

Summary:
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.

Reviewers: EricWF, mclow.lists, ldionne, #libc

Reviewed By: EricWF, #libc

Subscribers: dexonsmith, libcxx-commits

Tags: #libc

Differential Revision: https://reviews.llvm.org/D76150

Cr-Mirrored-From: https://chromium.googlesource.com/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 585a3cc31bb49f2a526dcb74dc9a980379193f93
diff --git a/include/stdexcept b/include/stdexcept
index 481f904..7a7f367 100644
--- a/include/stdexcept
+++ b/include/stdexcept
@@ -129,6 +129,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s)   : logic_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    domain_error(const domain_error&) _NOEXCEPT = default;
     virtual ~domain_error() _NOEXCEPT;
 #endif
 };
@@ -141,6 +142,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s)   : logic_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    invalid_argument(const invalid_argument&) _NOEXCEPT = default;
     virtual ~invalid_argument() _NOEXCEPT;
 #endif
 };
@@ -152,6 +154,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
     _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s)   : logic_error(__s) {}
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    length_error(const length_error&) _NOEXCEPT = default;
     virtual ~length_error() _NOEXCEPT;
 #endif
 };
@@ -164,6 +167,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s)   : logic_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    out_of_range(const out_of_range&) _NOEXCEPT = default;
     virtual ~out_of_range() _NOEXCEPT;
 #endif
 };
@@ -176,6 +180,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s)   : runtime_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    range_error(const range_error&) _NOEXCEPT = default;
     virtual ~range_error() _NOEXCEPT;
 #endif
 };
@@ -188,6 +193,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s)   : runtime_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    overflow_error(const overflow_error&) _NOEXCEPT = default;
     virtual ~overflow_error() _NOEXCEPT;
 #endif
 };
@@ -200,6 +206,7 @@
     _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s)   : runtime_error(__s) {}
 
 #ifndef _LIBCPP_ABI_VCRUNTIME
+    underflow_error(const underflow_error&) _NOEXCEPT = default;
     virtual ~underflow_error() _NOEXCEPT;
 #endif
 };