[libcxx-commits] [libcxx] [libc++] Implement P3836R2: Make `optional<T&>` trivially copyable (PR #171528)

William Tran-Viet via libcxx-commits libcxx-commits at lists.llvm.org
Mon Dec 22 21:41:14 PST 2025


================
@@ -95,5 +100,12 @@ int main(int, char**) {
         NonTrivialTypes::ApplyTypes<DoTestsMetafunction>{},
         DoTestsMetafunction<TrivialMoveNonTrivialCopy, TrivialCopyNonTrivialMove>{}
     );
+
+#if TEST_STD_VER >= 26
+    static_assert(std::is_trivially_copyable_v<std::optional<TrivialMoveNonTrivialCopy&>>);
----------------
smallp-o-p wrote:

Adding those checks caught something I missed regarding assignment!

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


More information about the libcxx-commits mailing list