From: Christopher Dykes Date: Sat, 20 May 2017 01:37:20 +0000 (-0700) Subject: Work around a compiler crash in VS 2017.3 Preview 1 X-Git-Tag: v2017.05.22.00~6 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=commitdiff_plain;h=f9da986ca9c8d0727133107e416d4b6a07310910 Work around a compiler crash in VS 2017.3 Preview 1 Summary: MSVC is being grumpy, and I want to continue to work from the preview build, so commit the workaround, as there's no significant difference. Upstream bug report: https://developercommunity.visualstudio.com/content/problem/59614/compiler-crash-when-constexpr-constructing-stdchro.html Reviewed By: yfeldblum Differential Revision: D5099876 fbshipit-source-id: 64d5573d78b14339ff3177dd910a22787463ccd2 --- diff --git a/folly/portability/Time.cpp b/folly/portability/Time.cpp index dec1daf4..cb644929 100755 --- a/folly/portability/Time.cpp +++ b/folly/portability/Time.cpp @@ -215,7 +215,7 @@ extern "C" int clock_gettime(clockid_t clock_id, struct timespec* tp) { } const auto unanosToTimespec = [](timespec* tp, unsigned_nanos t) -> int { - static constexpr unsigned_nanos one_sec(std::chrono::seconds(1)); + static constexpr unsigned_nanos one_sec{std::chrono::seconds(1)}; tp->tv_sec = time_t(std::chrono::duration_cast(t).count()); tp->tv_nsec = long((t % one_sec).count());