[libcxx-commits] [PATCH] D62928: Constrain function assignment operator (2574)
Zoe Carver via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 9 21:06:56 PST 2019
zoecarver updated this revision to Diff 232997.
zoecarver edited the summary of this revision.
zoecarver added a comment.
Herald added a subscriber: christof.
Herald added a project: libc++.
Address @ldionne comments
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D62928/new/
https://reviews.llvm.org/D62928
Files:
libcxx/include/functional
libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
libcxx/www/cxx1z_status.html
Index: libcxx/www/cxx1z_status.html
===================================================================
--- libcxx/www/cxx1z_status.html
+++ libcxx/www/cxx1z_status.html
@@ -299,7 +299,7 @@
<tr><td><a href="https://wg21.link/LWG2566">2566</a></td><td>Requirements on the first template parameter of container adaptors</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2571">2571</a></td><td>§[map.modifiers]/2 imposes nonsensical requirement on <tt>insert(InputIterator, InputIterator)</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2572">2572</a></td><td>The remarks for <tt>shared_ptr::operator*</tt> should apply to <i>cv</i>-qualified <tt>void</tt> as well</td><td>Jacksonville</td><td>Complete</td></tr>
- <tr><td><a href="https://wg21.link/LWG2574">2574</a></td><td>[fund.ts.v2] <tt>std::experimental::function::operator=(F&&)</tt> should be constrained</td><td>Jacksonville</td><td></td></tr>
+ <tr><td><a href="https://wg21.link/LWG2574">2574</a></td><td>[fund.ts.v2] <tt>std::experimental::function::operator=(F&&)</tt> should be constrained</td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2575">2575</a></td><td>[fund.ts.v2] <tt>experimental::function::assign</tt> should be removed</td><td>Jacksonville</td><td></td></tr>
<tr><td><a href="https://wg21.link/LWG2576">2576</a></td><td><tt>istream_iterator</tt> and <tt>ostream_iterator</tt> should use <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
<tr><td><a href="https://wg21.link/LWG2577">2577</a></td><td><tt>{shared,unique}_lock</tt> should use <tt>std::addressof</tt></td><td>Jacksonville</td><td>Complete</td></tr>
Index: libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
===================================================================
--- libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
+++ libcxx/test/std/utilities/function.objects/func.wrap/func.wrap.func/func.wrap.func.con/F_assign.pass.cpp
@@ -114,6 +114,26 @@
static_assert(!std::is_assignable<Fn&, RValueCallable&>::value, "");
static_assert(!std::is_assignable<Fn&, RValueCallable>::value, "");
}
+ {
+ using Fn = std::function<void(int, int, int)>;
+ static_assert(std::is_assignable<Fn&, Fn&&>::value, "");
+ }
+ {
+ using F1 = std::function<void(int, int)>;
+ using F2 = std::function<void(int, int, int)>;
+ static_assert(!std::is_assignable<F1&, F2&&>::value, "");
+ }
+ {
+ using F1 = std::function<int(int, int)>;
+ using F2 = std::function<A (int, int)>;
+ static_assert(!std::is_assignable<F1&, F2&&>::value, "");
+ static_assert(!std::is_assignable<F2&, F1&&>::value, "");
+ }
+ {
+ using F1 = std::function<void(int, int)>;
+ using F2 = std::function<void(int, int)&&>;
+ static_assert(!std::is_assignable<F1&, F2&&>::value, "");
+ }
#endif
return 0;
Index: libcxx/include/functional
===================================================================
--- libcxx/include/functional
+++ libcxx/include/functional
@@ -2304,7 +2304,7 @@
function& operator=(const function&);
function& operator=(function&&) _NOEXCEPT;
function& operator=(nullptr_t) _NOEXCEPT;
- template<class _Fp, class = _EnableIfCallable<_Fp>>
+ template<class _Fp, class = _EnableIfCallable<typename decay<_Fp>::type>>
function& operator=(_Fp&&);
~function();
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62928.232997.patch
Type: text/x-patch
Size: 3629 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191210/1641056c/attachment.bin>
More information about the libcxx-commits
mailing list