Commit 7b8c8076 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 1

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
parent 9b2bbca7
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment