From: Eric Niebler Date: Wed, 29 Jun 2016 22:43:31 +0000 (-0700) Subject: gcc-4.8 is not decaying types correctly in lambda init captures. Help it out. Fixes... X-Git-Tag: 2016.07.26~108 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e6aa2684a75a8c3077a763fca674a79bb61b47ad;p=folly.git gcc-4.8 is not decaying types correctly in lambda init captures. Help it out. Fixes open source build. Summary: Trivial change gets folly::ThreadLocal building again with gcc-4.8, needed by the Open Source build. Reviewed By: chadparry, yfeldblum Differential Revision: D3498657 fbshipit-source-id: cf36f2bef7f1d03d133d16bfd063f7a2ce681822 --- diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index ea9ae136..3bcfbfa2 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -107,10 +107,11 @@ struct ElementWrapper { DCHECK(deleter2 == nullptr); if (p) { ptr = p; - deleter2 = new std::function([d = d]( - void* pt, TLPDestructionMode mode) { - d(static_cast(pt), mode); - }); + auto d2 = d; // gcc-4.8 doesn't decay types correctly in lambda captures + deleter2 = new std::function( + [d2](void* pt, TLPDestructionMode mode) { + d2(static_cast(pt), mode); + }); ownsDeleter = true; guard.dismiss(); }