From 7bfd27ac478356e7c718b18b5eb3a3b277b833d1 Mon Sep 17 00:00:00 2001 From: Mattias Ellert Date: Tue, 3 Jun 2025 06:49:27 +0200 Subject: [PATCH] Use size_t for offset [ RUN ] VariableReflectionTest.StaticConstExprDatamember /builddir/build/BUILD/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp:545: Failure Expected equality of these values: 3 *(int*)offset Which is: 0 /builddir/build/BUILD/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp:561: Failure Expected equality of these values: 5 *(int*)offset Which is: 0 /builddir/build/BUILD/root-6.36.00/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp:580: Failure Expected equality of these values: 2 *(int*)offset Which is: 0 [ FAILED ] VariableReflectionTest.StaticConstExprDatamember (9 ms) --- .../unittests/CppInterOp/VariableReflectionTest.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp b/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp index 26dad4f25c..571ae5cd5d 100644 --- a/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp +++ b/interpreter/CppInterOp/unittests/CppInterOp/VariableReflectionTest.cpp @@ -552,7 +552,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) { EXPECT_EQ(datamembers.size(), 1); intptr_t offset = Cpp::GetVariableOffset(datamembers[0]); - EXPECT_EQ(3, *(int*)offset); + EXPECT_EQ(3, *(size_t*)offset); ASTContext& C = Interp->getCI()->getASTContext(); std::vector template_args = { @@ -568,7 +568,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) { EXPECT_EQ(datamembers.size(), 1); offset = Cpp::GetVariableOffset(datamembers[0]); - EXPECT_EQ(5, *(int*)offset); + EXPECT_EQ(5, *(size_t*)offset); std::vector ele_template_args = { {C.IntTy.getAsOpaquePtr()}, {C.FloatTy.getAsOpaquePtr()}}; @@ -587,7 +587,7 @@ TEST(VariableReflectionTest, StaticConstExprDatamember) { EXPECT_EQ(datamembers.size(), 1); offset = Cpp::GetVariableOffset(datamembers[0]); - EXPECT_EQ(2, *(int*)offset); + EXPECT_EQ(2, *(size_t*)offset); } TEST(VariableReflectionTest, GetEnumConstantDatamembers) { -- 2.49.0