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

Tim Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 21 00:46:39 PST 2017


tcanens 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)
----------------
EricWF wrote:
> 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.
My point is that the use of macro-ized `_NOEXCEPT_` suggests that we are supporting compilers that doesn't have noexcept-specifications. Given that, can we then use the `noexcept` operator here?


https://reviews.llvm.org/D40259





More information about the cfe-commits mailing list