summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Fiselier <eric@efcs.ca>2017-03-30 19:43:50 +0000
committerEric Fiselier <eric@efcs.ca>2017-03-30 19:43:50 +0000
commitd3209f932f73087c33ccae4b7e7403ca4ad94d28 (patch)
treea4d4ecd1a700f0e28d87ac8a2c815673e48f4544
parent21e8ce398d21f0d89c8c5a52d077305dbf68543a (diff)
downloadbcm5719-llvm-d3209f932f73087c33ccae4b7e7403ca4ad94d28.tar.gz
bcm5719-llvm-d3209f932f73087c33ccae4b7e7403ca4ad94d28.zip
Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
llvm-svn: 299100
-rw-r--r--libcxx/include/optional2
-rw-r--r--libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp14
-rw-r--r--libcxx/www/cxx1z_status.html2
3 files changed, 16 insertions, 2 deletions
diff --git a/libcxx/include/optional b/libcxx/include/optional
index 002842f5b31..a80120f0075 100644
--- a/libcxx/include/optional
+++ b/libcxx/include/optional
@@ -531,7 +531,7 @@ private:
};
template <class _Up>
using _CheckOptionalArgsCtor = conditional_t<
- !is_same_v<in_place_t, _Up> &&
+ !is_same_v<decay_t<_Up>, in_place_t> &&
!is_same_v<decay_t<_Up>, optional>,
_CheckOptionalArgsConstructor,
__check_tuple_constructor_fail
diff --git a/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp b/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
index 4020d70a46f..d068fbc2db7 100644
--- a/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
+++ b/libcxx/test/std/utilities/optional/optional.object/optional.object.ctor/U.pass.cpp
@@ -35,6 +35,11 @@ struct ExplicitThrow
constexpr explicit ExplicitThrow(int x) { if (x != -1) TEST_THROW(6);}
};
+struct ImplicitAny {
+ template <class U>
+ constexpr ImplicitAny(U&&) {}
+};
+
template <class To, class From>
constexpr bool implicit_conversion(optional<To>&& opt, const From& v)
@@ -79,6 +84,15 @@ void test_implicit()
using T = TestTypes::TestType;
assert(implicit_conversion<T>(3, T(3)));
}
+ {
+ using O = optional<ImplicitAny>;
+ static_assert(!test_convertible<O, std::in_place_t>(), "");
+ static_assert(!test_convertible<O, std::in_place_t&>(), "");
+ static_assert(!test_convertible<O, const std::in_place_t&>(), "");
+ static_assert(!test_convertible<O, std::in_place_t&&>(), "");
+ static_assert(!test_convertible<O, const std::in_place_t&&>(), "");
+
+ }
#ifndef TEST_HAS_NO_EXCEPTIONS
{
try {
diff --git a/libcxx/www/cxx1z_status.html b/libcxx/www/cxx1z_status.html
index 6b832d6a405..bca7f320324 100644
--- a/libcxx/www/cxx1z_status.html
+++ b/libcxx/www/cxx1z_status.html
@@ -460,7 +460,7 @@
<tr><td><a href="http://wg21.link/LWG2835">2835</a></td><td>LWG 2536 seems to misspecify &lt;tgmath.h&gt;</td><td>Kona</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2837">2837</a></td><td>gcd and lcm should support a wider range of input values</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2838">2838</a></td><td>is_literal_type specification needs a little cleanup</td><td>Kona</td><td>Complete</td></tr>
- <tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&amp;&amp;) should decay U</td><td>Kona</td><td></td></tr>
+ <tr><td><a href="http://wg21.link/LWG2842">2842</a></td><td>in_place_t check for optional::optional(U&amp;&amp;) should decay U</td><td>Kona</td><td>Complete</td></tr>
<tr><td><a href="http://wg21.link/LWG2850">2850</a></td><td>std::function move constructor does unnecessary work</td><td>Kona</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2853">2853</a></td><td>Possible inconsistency in specification of erase in [vector.modifiers]</td><td>Kona</td><td></td></tr>
<tr><td><a href="http://wg21.link/LWG2855">2855</a></td><td>std::throw_with_nested("string_literal")</td><td>Kona</td><td></td></tr>
OpenPOWER on IntegriCloud