[PATCH] D32824: [libc++] Use placeholder return types to avoid hard errors during overload resolution

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 3 15:35:54 PDT 2017


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

This change regresses other code. By changing `__bind_return<...>::type` into `decltype(auto)` you prevent the member functions from SFINAE'ing. For example:

  #include <functional>
  
  struct Func {
    template <class ...Args>
    void operator()(Args&&...) = delete;
  
    template <class ...Args>
    void operator()(Args&&...) const {}
  };
  
  int main() {
      Func f;
      std::bind(f)(); // Broken after your change.
  }

This patch cannot introduce regressions but changing to using `decltype(auto)` does. I'm not sure the behavior you want is possible. The library is required to evaluate the validity of calling the specified functor in the signature of the call operator in order to correctly SFINAE.
I think this makes accepting the code in PR32856 impossible.


https://reviews.llvm.org/D32824





More information about the cfe-commits mailing list