[libcxx-commits] [libcxx] [libcxx] makes `expected` trivially assignable when both members are … (PR #74768)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Dec 8 12:14:51 PST 2023


================
@@ -282,10 +284,27 @@ class expected {
     }
   }
 
+  static constexpr bool __is_trivially_move_assignable =
+      is_trivially_move_constructible_v<_Tp> &&
+      is_trivially_move_assignable_v<_Tp> &&
+      is_trivially_move_constructible_v<_Err> &&
+      is_trivially_move_assignable_v<_Err>;
+
+  static constexpr bool __is_trivially_copy_assignable =
----------------
huixie90 wrote:

This is incorrect. The types’ assignment operators were not used at all. 

If you assign an expected with value to an expected with error, what’s in the spec is to destroy + construct. 

so what you really need to check is the destructor and copy/move constructor. 

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


More information about the libcxx-commits mailing list