From: Nathan Bronson Date: Tue, 16 Aug 2016 20:11:33 +0000 (-0700) Subject: explicit return types in Partial to work around gcc bug X-Git-Tag: v2016.08.22.00~30 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=ec3d4073a86787ec7e49f48ddc9d8f44a6714ed2 explicit return types in Partial to work around gcc bug Summary: Workaround for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70983 Reviewed By: mhx, spacedentist Differential Revision: D3724410 fbshipit-source-id: 692b1c1f49211a4170900505339794f09cec2369 --- diff --git a/folly/Partial.h b/folly/Partial.h index f19941fb..248a86a9 100644 --- a/folly/Partial.h +++ b/folly/Partial.h @@ -32,8 +32,14 @@ class Partial { : f_(std::forward(callable)), stored_args_(std::forward(args)...) {} + // full auto doesn't work here due to + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70983 :( + template - auto operator()(CArgs&&... cargs) & { + auto operator()(CArgs&&... cargs) & -> decltype(applyTuple( + static_cast(f_), + static_cast(stored_args_), + std::forward_as_tuple(std::forward(cargs)...))) { return applyTuple( static_cast(f_), static_cast(stored_args_), @@ -41,7 +47,10 @@ class Partial { } template - auto operator()(CArgs&&... cargs) const& { + auto operator()(CArgs&&... cargs) const& -> decltype(applyTuple( + static_cast(f_), + static_cast(stored_args_), + std::forward_as_tuple(std::forward(cargs)...))) { return applyTuple( static_cast(f_), static_cast(stored_args_), @@ -49,7 +58,10 @@ class Partial { } template - auto operator()(CArgs&&... cargs) && { + auto operator()(CArgs&&... cargs) && -> decltype(applyTuple( + static_cast(f_), + static_cast(stored_args_), + std::forward_as_tuple(std::forward(cargs)...))) { return applyTuple( static_cast(f_), static_cast(stored_args_),