From 404e1201f9e602e196159cde181ceffa8e998b37 Mon Sep 17 00:00:00 2001 From: Jake Hemstad Date: Tue, 6 Oct 2020 15:57:49 -0500 Subject: [PATCH] Add explicit casts to workaround nvcc bug. nvcc is failing on evaluating this code in a constant expression without the explicit casts. nvbug/3145483 --- libcxx/include/chrono | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libcxx/include/chrono b/libcxx/include/chrono index ae0aa21b44..ce2ea81fb8 100644 --- a/libcxx/include/chrono +++ b/libcxx/include/chrono @@ -2017,7 +2017,8 @@ constexpr weekday operator-(const weekday& __lhs, const days& __rhs) noexcept _LIBCUDACXX_INLINE_VISIBILITY constexpr days operator-(const weekday& __lhs, const weekday& __rhs) noexcept { - const int __wdu = __lhs.c_encoding() - __rhs.c_encoding(); + // casts are required to work around nvcc bug 3145483 + const int __wdu = static_cast(__lhs.c_encoding())- static_cast(__rhs.c_encoding()); const int __wk = (__wdu >= 0 ? __wdu : __wdu-6) / 7; return days{__wdu - __wk * 7}; }