From: Christopher Dykes Date: Fri, 22 Jul 2016 17:13:42 +0000 (-0700) Subject: Use decltype to get the type of a non-static local X-Git-Tag: 2016.07.26~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7b8c8076b423a403b7601ced72ba7b0a4ffebd4e;p=folly.git Use decltype to get the type of a non-static local Summary: As the `sizeof()` is being evaluated in a static context, MSVC doesn't let you reference non-static locals. Solve the issue by getting the type of the local via `decltype` instead. Reviewed By: yfeldblum Differential Revision: D3600845 fbshipit-source-id: 825d93ced8f09d9f4bf0dcf02142f47a0ec32605 --- diff --git a/folly/io/async/test/AsyncSSLSocketTest.h b/folly/io/async/test/AsyncSSLSocketTest.h index 42bb03ac..384198d1 100644 --- a/folly/io/async/test/AsyncSSLSocketTest.h +++ b/folly/io/async/test/AsyncSSLSocketTest.h @@ -1085,8 +1085,9 @@ class SSLClient : public AsyncSocket::ConnectCallback, // socket, even if the maxReadsPerEvent_ is hit during // a event loop iteration. static constexpr size_t kMaxReadsPerEvent = 2; + // 2 event loop iterations static constexpr size_t kMaxReadBufferSz = - sizeof(readbuf_) / kMaxReadsPerEvent / 2; // 2 event loop iterations + sizeof(decltype(readbuf_)) / kMaxReadsPerEvent / 2; public: SSLClient(EventBase *eventBase,