Implement LWG 2842 - optional(U&&) needs to SFINAE on decay_t<in_place_t>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299100 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -460,7 +460,7 @@
|
||||
<tr><td><a href="http://wg21.link/LWG2835">2835</a></td><td>LWG 2536 seems to misspecify <tgmath.h></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&&) 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&&) 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>
|
||||
|
||||
Reference in New Issue
Block a user