Work around a compiler crash in VS 2017.3 Preview 1
authorChristopher Dykes <cdykes@fb.com>
Sat, 20 May 2017 01:37:20 +0000 (18:37 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Sat, 20 May 2017 01:51:06 +0000 (18:51 -0700)
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

folly/portability/Time.cpp

index dec1daf427969e817ae0fbb0cded6f473079ef73..cb64492925167053c33331e66ef29cae2865cbd3 100755 (executable)
@@ -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<std::chrono::seconds>(t).count());
     tp->tv_nsec = long((t % one_sec).count());