[libcxx-commits] [PATCH] D131849: [libc++][test] Restore several variant tests

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Aug 14 00:40:30 PDT 2022


fsb4000 created this revision.
fsb4000 added a reviewer: ldionne.
fsb4000 added a project: libc++.
Herald added a project: All.
fsb4000 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

They were removed in https://reviews.llvm.org/D120684
I think it was made by mistake...
The code compiles just fine, even with `-Weverything`: https://gcc.godbolt.org/z/oKjvb8oPx


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131849

Files:
  libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp


Index: libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
===================================================================
--- libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
+++ libcxx/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp
@@ -211,6 +211,16 @@
     assert(v.index() == 1);
     assert(std::get<1>(v) == nullptr);
   }
+  {
+    std::variant<bool volatile, int> v = 42;
+    v = false;
+    assert(v.index() == 0);
+    assert(!std::get<0>(v));
+    bool lvt = true;
+    v = lvt;
+    assert(v.index() == 0);
+    assert(std::get<0>(v));
+  }
 #if !defined(TEST_VARIANT_HAS_NO_REFERENCES)
   {
     using V = std::variant<int &, int &&, long>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131849.452489.patch
Type: text/x-patch
Size: 732 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220814/9b601983/attachment.bin>


More information about the libcxx-commits mailing list