From 77ff6ad8ecf8bb9824bc244f7a3ee6e0439cbb96 Mon Sep 17 00:00:00 2001 From: Christoph Lehmann <christoph.lehmann@ufz.de> Date: Thu, 16 May 2024 14:14:04 +0200 Subject: [PATCH] [T] Fixed MSVC compiler warning Warning was: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\memory(3382): warning C4244: 'argument': conversion from 'const uintptr_t' to 'const unsigned int', possible loss of data C:/Users/gitlab/gitlab/_b/bg4d5s_d/0/ogs/ogs/Tests/ProcessLib/TestReflectIPData.cpp(792): note: see reference to function template instantiation 'std::unique_ptr<LocAsm,std::default_delete<LocAsm>> std::make_unique<LocAsm,const size_t&,0>(const size_t &)' being compiled --- Tests/ProcessLib/TestReflectIPData.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Tests/ProcessLib/TestReflectIPData.cpp b/Tests/ProcessLib/TestReflectIPData.cpp index 22ec80bad35..111e4ca245c 100644 --- a/Tests/ProcessLib/TestReflectIPData.cpp +++ b/Tests/ProcessLib/TestReflectIPData.cpp @@ -729,7 +729,17 @@ TYPED_TEST(ProcessLib_ReflectIPData, IPWriterTest) std::size_t const num_int_pts = 8; std::vector<std::unique_ptr<LocAsm>> loc_asms; - loc_asms.push_back(std::make_unique<LocAsm>(num_int_pts)); + // emplace...new is a workaround for an MSVC compiler warning: + // C:\Program Files (x86)\Microsoft Visual + // Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\memory(3382): + // warning C4244: 'argument': conversion from 'const uintptr_t' to 'const + // unsigned int', possible loss of data + // C:/Users/gitlab/gitlab/_b/bg4d5s_d/0/ogs/ogs/Tests/ProcessLib/ + // TestReflectIPData.cpp(792): + // note: see reference to function template instantiation + // 'std::unique_ptr<LocAsm,std::default_delete<LocAsm>> + // std::make_unique<LocAsm,const size_t&,0>(const size_t &)' being compiled + loc_asms.emplace_back(new LocAsm{num_int_pts}); auto& loc_asm = *loc_asms.front(); std::unique_ptr<MeshLib::Mesh> mesh{ @@ -789,7 +799,17 @@ TYPED_TEST(ProcessLib_ReflectIPData, CellAverageTest) std::size_t const num_int_pts = 8; std::vector<std::unique_ptr<LocAsm>> loc_asms; - loc_asms.push_back(std::make_unique<LocAsm>(num_int_pts)); + // emplace...new is a workaround for an MSVC compiler warning: + // C:\Program Files (x86)\Microsoft Visual + // Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\memory(3382): + // warning C4244: 'argument': conversion from 'const uintptr_t' to 'const + // unsigned int', possible loss of data + // C:/Users/gitlab/gitlab/_b/bg4d5s_d/0/ogs/ogs/Tests/ProcessLib/ + // TestReflectIPData.cpp(792): + // note: see reference to function template instantiation + // 'std::unique_ptr<LocAsm,std::default_delete<LocAsm>> + // std::make_unique<LocAsm,const size_t&,0>(const size_t &)' being compiled + loc_asms.emplace_back(new LocAsm{num_int_pts}); auto& loc_asm = *loc_asms.front(); std::unique_ptr<MeshLib::Mesh> mesh{ -- GitLab