[libcxx-commits] [libcxx] [libc++] Add default copy ctor to "__chrono/exception.h" (PR #95338)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 12 17:39:54 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Haowei (zeroomega)

<details>
<summary>Changes</summary>

After PR#<!-- -->90394, "__chrono/exception.h" will trigger "deprecated-copy-with-user-provided-dtor" warning on Windows x64 runtime testing with ToT Clang. This patch addresses this issue by explicitly adding those default copy ctors.

It is a bit weird that the same warning will not happen when testing on Linux x64 under the same condition, despite the warning flag was enabled (with `-Wdeprecated-copy -Wdeprecated-copy-dtor`). It might be a bug.

---
Full diff: https://github.com/llvm/llvm-project/pull/95338.diff


1 Files Affected:

- (modified) libcxx/include/__chrono/exception.h (+6) 


``````````diff
diff --git a/libcxx/include/__chrono/exception.h b/libcxx/include/__chrono/exception.h
index 75fd0615b7e08..28ed9ac6ba3b9 100644
--- a/libcxx/include/__chrono/exception.h
+++ b/libcxx/include/__chrono/exception.h
@@ -48,6 +48,9 @@ class nonexistent_local_time : public runtime_error {
                             "creating an nonexistent_local_time from a local_info that is not non-existent");
   }
 
+  nonexistent_local_time(const nonexistent_local_time&) = default;
+  nonexistent_local_time& operator=(const nonexistent_local_time&) = default;
+
   _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~nonexistent_local_time() override; // exported as key function
 
 private:
@@ -89,6 +92,9 @@ class ambiguous_local_time : public runtime_error {
                             "creating an ambiguous_local_time from a local_info that is not ambiguous");
   }
 
+  ambiguous_local_time(const ambiguous_local_time&) = default;
+  ambiguous_local_time& operator=(const ambiguous_local_time&) = default;
+
   _LIBCPP_AVAILABILITY_TZDB _LIBCPP_EXPORTED_FROM_ABI ~ambiguous_local_time() override; // exported as key function
 
 private:

``````````

</details>


https://github.com/llvm/llvm-project/pull/95338


More information about the libcxx-commits mailing list