[libcxx-commits] [PATCH] D129928: Conversion from '__int64' to 'long', possible loss of data

Igor Zhukov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jul 16 03:05:45 PDT 2022


fsb4000 created this revision.
fsb4000 added a project: libc++.
Herald added a project: All.
fsb4000 requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

llvm-project\libcxx\test\std\time\time.hms\time.hms.members\seconds.pass.cpp(38): note: see reference to function template instantiation 'long check_seconds<std::chrono::seconds>(Duration)' being compiled

  with
  [
      Duration=std::chrono::seconds
  ]

llvm-project\libcxx\test\std\time\time.hms\time.hms.members\seconds.pass.cpp(31): warning C4244: 'return': conversion from '_Rep' to 'long', possible loss of data

  with
  [
      _Rep=__int64
  ]


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129928

Files:
  libcxx/test/std/time/time.hms/time.hms.members/seconds.pass.cpp
  libcxx/test/std/time/time.hms/time.hms.members/subseconds.pass.cpp


Index: libcxx/test/std/time/time.hms/time.hms.members/subseconds.pass.cpp
===================================================================
--- libcxx/test/std/time/time.hms/time.hms.members/subseconds.pass.cpp
+++ libcxx/test/std/time/time.hms/time.hms.members/subseconds.pass.cpp
@@ -23,7 +23,7 @@
 #include "test_macros.h"
 
 template <typename Duration>
-constexpr long check_subseconds(Duration d)
+constexpr long long check_subseconds(Duration d)
 {
     using HMS = std::chrono::hh_mm_ss<Duration>;
     ASSERT_SAME_TYPE(typename HMS::precision, decltype(std::declval<HMS>().subseconds()));
Index: libcxx/test/std/time/time.hms/time.hms.members/seconds.pass.cpp
===================================================================
--- libcxx/test/std/time/time.hms/time.hms.members/seconds.pass.cpp
+++ libcxx/test/std/time/time.hms/time.hms.members/seconds.pass.cpp
@@ -23,7 +23,7 @@
 #include "test_macros.h"
 
 template <typename Duration>
-constexpr long check_seconds(Duration d)
+constexpr long long check_seconds(Duration d)
 {
     using HMS = std::chrono::hh_mm_ss<Duration>;
     ASSERT_SAME_TYPE(std::chrono::seconds, decltype(std::declval<HMS>().seconds()));


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129928.445213.patch
Type: text/x-patch
Size: 1179 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220716/e1954a31/attachment.bin>


More information about the libcxx-commits mailing list