Update status for std::optional LWG issues and fix an optional SFINAE bug

llvm-svn: 284323
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: 015fcffd57fb71fa29d307ac54b8626c8088b856
diff --git a/include/experimental/optional b/include/experimental/optional
index 966c889..ebe11e6 100644
--- a/include/experimental/optional
+++ b/include/experimental/optional
@@ -487,7 +487,11 @@
     operator->() const
     {
         _LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
+#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+        return _VSTD::addressof(this->__val_);
+#else
         return __operator_arrow(__has_operator_addressof<value_type>{});
+#endif
     }
 
     _LIBCPP_INLINE_VISIBILITY
diff --git a/include/optional b/include/optional
index 46252c7..c64aa8f 100644
--- a/include/optional
+++ b/include/optional
@@ -681,12 +681,14 @@
     // LWG2756
     template <class _Up = value_type,
               class = enable_if_t
-                      <
-                          !is_same_v<_Up, optional> &&
-                          !(is_same_v<_Up, value_type> && is_scalar_v<value_type>) &&
-                          is_constructible_v<value_type, _Up> &&
-                          is_assignable_v<value_type&, _Up>
-                      >
+                      <__lazy_and<
+                          integral_constant<bool,
+                              !is_same_v<decay_t<_Up>, optional> &&
+                              !(is_same_v<_Up, value_type> && is_scalar_v<value_type>)
+                          >,
+                          is_constructible<value_type, _Up>,
+                          is_assignable<value_type&, _Up>
+                      >::value>
              >
     _LIBCPP_INLINE_VISIBILITY
     optional&