remove misleading comment in Partial.h
authorSven Over <over@fb.com>
Tue, 13 Jun 2017 16:17:06 +0000 (09:17 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 13 Jun 2017 16:20:43 +0000 (09:20 -0700)
Summary:
The removed comment cites a gcc compiler bug as a reason to spell
out the return type of the three operator() methods. While that
compiler bug can lead to compiler errors in some situations,
it is not the only reason why we need the return type arrow
notation.

If the compiler tries to instantiate operator() with a set of
parameters that the embedded function does not accept, then the
substitution failure is inside decltype, which is not a compiler
error (SFINAE) but just means that the Partial class doesn't define
operator() for that parameter signature. Without decltype, the body
of operator() is ill-formed and that is a compiler error.

Reviewed By: meyering

Differential Revision: D5236537

fbshipit-source-id: 7daa0fbcf128a2c7c5c36532a5402deba394e1b8

folly/Partial.h

index 518e91ed673056d03ee4b1baa397d2b63dd6cf2d..b39145287cf7eab928c00a18bf99ec5a0d42fb67 100644 (file)
@@ -39,9 +39,6 @@ class Partial {
       : f_(std::forward<Callable>(callable)),
         stored_args_(std::forward<Args>(args)...) {}
 
-  // full auto doesn't work here due to
-  // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70983 :(
-
   template <typename... CArgs>
   auto operator()(CArgs&&... cargs) & -> decltype(applyTuple(
       static_cast<F&>(f_),