From dc82c1573a88316493fb66c78944345cdafda57e Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Fri, 11 Oct 2019 13:39:04 -0700 Subject: [PATCH] [hardware][interfaces][vehicle] fix -Wdangling-gsl in test Chaining the method calls in such a way otherwise returns a dangling pointer to a temporary object. Bug: 139945549 Test: mm Change-Id: I0783fccbb6f11e7e37bd059445265227359649cf Signed-off-by: Nick Desaulniers --- .../vehicle/2.0/default/tests/VehicleObjectPool_test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp index a291351f0b..4e3ade15a3 100644 --- a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp +++ b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp @@ -57,11 +57,11 @@ public: }; TEST_F(VehicleObjectPoolTest, valuePoolBasicCorrectness) { - void* raw = valuePool->obtain(VehiclePropertyType::INT32).get(); + auto value = valuePool->obtain(VehiclePropertyType::INT32); // At this point, v1 should be recycled and the only object in the pool. - ASSERT_EQ(raw, valuePool->obtain(VehiclePropertyType::INT32).get()); + ASSERT_EQ(value.get(), valuePool->obtain(VehiclePropertyType::INT32).get()); // Obtaining value of another type - should return a new object - ASSERT_NE(raw, valuePool->obtain(VehiclePropertyType::FLOAT).get()); + ASSERT_NE(value.get(), valuePool->obtain(VehiclePropertyType::FLOAT).get()); ASSERT_EQ(3u, stats->Obtained); ASSERT_EQ(2u, stats->Created);