[libcxx] r337984 - [libc++] Follow-up to r337968: use an explicit cast as suggested by Eric

Alex Lorenz via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 25 16:59:54 PDT 2018


Author: arphaman
Date: Wed Jul 25 16:59:54 2018
New Revision: 337984

URL: http://llvm.org/viewvc/llvm-project?rev=337984&view=rev
Log:
[libc++] Follow-up to r337968: use an explicit cast as suggested by Eric

Modified:
    libcxx/trunk/src/experimental/filesystem/filesystem_common.h

Modified: libcxx/trunk/src/experimental/filesystem/filesystem_common.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/experimental/filesystem/filesystem_common.h?rev=337984&r1=337983&r2=337984&view=diff
==============================================================================
--- libcxx/trunk/src/experimental/filesystem/filesystem_common.h (original)
+++ libcxx/trunk/src/experimental/filesystem/filesystem_common.h Wed Jul 25 16:59:54 2018
@@ -393,8 +393,10 @@ bool set_file_times(const path& p, std::
                     error_code& ec) {
 #if !defined(_LIBCPP_USE_UTIMENSAT)
   using namespace chrono;
-  auto Convert = [](long nsec) -> decltype(std::declval<::timeval>().tv_usec) {
-    return duration_cast<microseconds>(nanoseconds(nsec)).count();
+  auto Convert = [](long nsec) {
+    using int_type = decltype(std::declval<::timeval>().tv_usec);
+    auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
+    return static_cast<int_type>(dur);
   };
   struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)},
                                      {TS[1].tv_sec, Convert(TS[1].tv_nsec)}};




More information about the cfe-commits mailing list