[PATCH] D40259: [libcxx] LWG2993: reference_wrapper<T> conversion from T&&

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 00:04:46 PST 2017


EricWF added inline comments.


================
Comment at: include/__functional_base:396
+        !is_same<__uncvref_t<_Up>, reference_wrapper>::value
+    >::type, bool _IsNothrow = noexcept(__bind(_VSTD::declval<_Up>()))>
+    _LIBCPP_INLINE_VISIBILITY reference_wrapper(_Up&& __u) _NOEXCEPT_(_IsNothrow)
----------------
tcanens wrote:
> Is it safe to do this when we are using `_NOEXCEPT_` in the next line?
It should be. The noexcept condition should only be evaluated *as needed* for functions selected by overload resolution. i.e. The noexcept condition is only considered on well-formed functions. And this function is only well-formed if `_IsNothrow` is well formed.

If `IsNothrow` is ill-formed, it will prevent the functions noexcept specifier from ever being evaluated.


https://reviews.llvm.org/D40259





More information about the cfe-commits mailing list