Add clang -Wconstant-conversion (#80461)

This catchs the compilation error detected in https://github.com/pytorch/pytorch/pull/75400

Pull Request resolved: https://github.com/pytorch/pytorch/pull/80461
Approved by: https://github.com/osalpekar
This commit is contained in:
Huy Do 2022-06-29 23:42:20 +00:00 committed by PyTorch MergeBot
parent 1058b47562
commit 39bd81a11f

View File

@ -840,6 +840,7 @@ if(NOT MSVC)
# These flags are not available in GCC-4.8.5. Set only when using clang.
# Compared against https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/Option-Summary.html
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
string(APPEND CMAKE_CXX_FLAGS " -Wconstant-conversion")
string(APPEND CMAKE_CXX_FLAGS " -Wno-invalid-partial-specialization")
string(APPEND CMAKE_CXX_FLAGS " -Wno-typedef-redefinition")
string(APPEND CMAKE_CXX_FLAGS " -Wno-unknown-warning-option")