Skip to content

Commit 8c3f849

Browse files
xuhancnpytorchmergebot
authored andcommitted
[aot] fix greater_than_max build fail on Windows. (pytorch#158479)
Error snapshot: <img width="937" height="110" alt="image" src="https://github.com/user-attachments/assets/10195f84-83c4-42db-af3c-76f875a6a983" /> Reason: `std::numeric_limits::max` is confilct to windef.h:`max(a, b)` Fix code: <img width="488" height="269" alt="image" src="https://github.com/user-attachments/assets/3328c37b-7c89-435e-944c-4ca7c9b6c5b6" /> Pull Request resolved: pytorch#158479 Approved by: https://github.com/desertfire
1 parent 6f73e06 commit 8c3f849

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

c10/util/TypeSafeSignMath.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ template <typename Limit, typename T>
7979
inline constexpr bool greater_than_max(const T& x) {
8080
constexpr bool can_overflow =
8181
std::numeric_limits<T>::digits > std::numeric_limits<Limit>::digits;
82-
return can_overflow && x > std::numeric_limits<Limit>::max();
82+
return can_overflow && x > (std::numeric_limits<Limit>::max)();
8383
}
8484

8585
#ifdef __GNUC__

0 commit comments

Comments
 (0)