[libcxx-commits] [libcxx] r364574 - Add a missing '__uncvref_t' to the SFINAE constraints for optional's assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report

Marshall Clow via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 27 11:40:55 PDT 2019


Author: marshall
Date: Thu Jun 27 11:40:55 2019
New Revision: 364574

URL: http://llvm.org/viewvc/llvm-project?rev=364574&view=rev
Log:
Add a missing '__uncvref_t' to the SFINAE constraints for optional's assignment operator. Fixes PR38638. Thanks to Jonathan Wakely for the report

Modified:
    libcxx/trunk/include/optional
    libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp

Modified: libcxx/trunk/include/optional
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/optional?rev=364574&r1=364573&r2=364574&view=diff
==============================================================================
--- libcxx/trunk/include/optional (original)
+++ libcxx/trunk/include/optional Thu Jun 27 11:40:55 2019
@@ -773,7 +773,7 @@ public:
                       _And<
                           _IsNotSame<__uncvref_t<_Up>, optional>,
                           _Or<
-                              _IsNotSame<_Up, value_type>,
+                              _IsNotSame<__uncvref_t<_Up>, value_type>,
                               _Not<is_scalar<value_type>>
                           >,
                           is_constructible<value_type, _Up>,

Modified: libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp?rev=364574&r1=364573&r2=364574&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/optional/optional.object/optional.object.assign/assign_value.pass.cpp Thu Jun 27 11:40:55 2019
@@ -241,6 +241,16 @@ enum MyEnum { Zero, One, Two, Three, For
 
 using Fn = void(*)();
 
+// https://bugs.llvm.org/show_bug.cgi?id=38638
+template <class T>
+constexpr T pr38638(T v)
+{
+  std::optional<T> o;
+  o = v;
+  return *o + 2;
+}
+
+
 int main(int, char**)
 {
     test_sfinae();
@@ -269,5 +279,7 @@ int main(int, char**)
     }
     test_throws();
 
+    static_assert(pr38638(3) == 5, "");
+
   return 0;
 }




More information about the libcxx-commits mailing list