From ec3d4073a86787ec7e49f48ddc9d8f44a6714ed2 Mon Sep 17 00:00:00 2001 From: Nathan Bronson Date: Tue, 16 Aug 2016 13:11:33 -0700 Subject: [PATCH] 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 --- folly/Partial.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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_), -- 2.34.1