aganea created this revision. aganea added reviewers: ASDenysPetrov, thieta, hans. Herald added subscribers: steakhal, mgorny. Herald added a project: All. aganea requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
I'm seeing the following with MSVC 2022: C:\git\llvm-project\clang\unittests\StaticAnalyzer\RangeSetTest.cpp(97): warning C4309: 'initializing': truncation of constant value C:\git\llvm-project\clang\unittests\StaticAnalyzer\RangeSetTest.cpp(948): note: see reference to class template instantiation '`anonymous-namespace'::TestValues<F>' being compiled C:\git\llvm-project\clang\unittests\StaticAnalyzer\RangeSetTest.cpp(942): note: while compiling class template member function 'void `anonymous-namespace'::RangeSetCastToPromotionConversionTest_Test_Test<T>::TestBody(void)' The issue here is that `RangeSetCastToPromotionConversionTest` tries to instantiate the template at L947, `using TV = TestValues<F>;` which ends up trying to assign at L94, `static constexpr T ToA = FromA + 2;` which overflows with `T=char`. Ideally, we wouldn't need `FromA/ToA/FromB/ToB` for this test. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D129152 Files: clang/unittests/StaticAnalyzer/CMakeLists.txt Index: clang/unittests/StaticAnalyzer/CMakeLists.txt =================================================================== --- clang/unittests/StaticAnalyzer/CMakeLists.txt +++ clang/unittests/StaticAnalyzer/CMakeLists.txt @@ -20,6 +20,11 @@ TestReturnValueUnderConstruction.cpp ) +if(MSVC) + # warning C4309: 'initializing': truncation of constant value + set_source_files_properties(RangeSetTest.cpp PROPERTIES COMPILE_FLAGS -wd4309) +endif() + clang_target_link_libraries(StaticAnalysisTests PRIVATE clangBasic
Index: clang/unittests/StaticAnalyzer/CMakeLists.txt =================================================================== --- clang/unittests/StaticAnalyzer/CMakeLists.txt +++ clang/unittests/StaticAnalyzer/CMakeLists.txt @@ -20,6 +20,11 @@ TestReturnValueUnderConstruction.cpp ) +if(MSVC) + # warning C4309: 'initializing': truncation of constant value + set_source_files_properties(RangeSetTest.cpp PROPERTIES COMPILE_FLAGS -wd4309) +endif() + clang_target_link_libraries(StaticAnalysisTests PRIVATE clangBasic
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits