improve compile-time errmsg for f.get()
Summary: We have seen some caller-confusion after removing the lvalue-qualified Future::get(). Goal of this is to improve/clarify the compile-time error-msg for `future.get()`. The resulting error-messages are compiler-dependent, but generally they are more explicit, indicating an explicit deletion of the lvalue-qualified method, and in some cases also displaying the deprecation-message: * Clang: * old: 'this' argument to member function 'get' is an lvalue, but function has rvalue ref-qualifier * new: call to deleted member function 'get': must be rvalue-qualified, e.g., std::move(future).get() * gcc: * old: error: passing 'Future<int>' as 'this' argument discards qualifiers [-fpermissive] * new: use of deleted function 'T Future<T>::get() & [with T = int]' * MS VC: * old: 'int Future<int>::get(void) &&': cannot convert 'this' pointer from 'Future<int>' to 'Future<int> &&' * new: 'int Future<int>::get(void) &': attempting to reference a deleted function * icc: * old: function "Future<T>::get [with T=int]" (declared at line 6) cannot be called on an lvalue * new: function "Future<T>::get() & [with T=int]" (declared at line 9) was declared deprecated ("must be rvalue-qualified, e.g., std::move(future).get()") Reviewed By: yfeldblum Differential Revision: D9071064 fbshipit-source-id: a40712ce94fd10bc153cb74a7d6d6a0539e07a15
Showing
Please register or sign in to comment