From d691471816b38ef5814fa5b6788bb885b72309de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Wed, 29 Dec 2021 23:44:18 +0100 Subject: [PATCH] Improve aliasing issues in C++03 that could lead to release tests failing in some tests --- test/allocator_argument_tester.hpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/test/allocator_argument_tester.hpp b/test/allocator_argument_tester.hpp index f3ef0b6..16b19bc 100644 --- a/test/allocator_argument_tester.hpp +++ b/test/allocator_argument_tester.hpp @@ -193,19 +193,31 @@ struct allocator_argument_tester //Move constructors allocator_argument_tester(BOOST_RV_REF(allocator_argument_tester) other) - : construction_type(NotUsesAllocator), value(other.value) - { other.value = 0; other.construction_type = NotUsesAllocator; } + : construction_type(NotUsesAllocator), value(((allocator_argument_tester &)other).value) + { + allocator_argument_tester &o = other; + o.value = 0; + o.construction_type = NotUsesAllocator; + } allocator_argument_tester( BOOST_RV_REF(allocator_argument_tester) other , typename base_type::allocator_constructor_type) - : construction_type(ConstructibleSuffix), value(other.value) - { other.value = 0; other.construction_type = ConstructibleSuffix; } + : construction_type(ConstructibleSuffix), value(((allocator_argument_tester &)other).value) + { + allocator_argument_tester &o = other; + o.value = 0; + o.construction_type = ConstructibleSuffix; + } allocator_argument_tester( typename base_type::allocator_arg_type , typename base_type::allocator_constructor_type , BOOST_RV_REF(allocator_argument_tester) other) - : construction_type(ConstructiblePrefix), value(other.value) - { other.value = 0; other.construction_type = ConstructiblePrefix; } + : construction_type(ConstructiblePrefix), value(((allocator_argument_tester &)other).value) + { + allocator_argument_tester &o = other; + o.value = 0; + o.construction_type = ConstructiblePrefix; + } ConstructionTypeEnum construction_type; int value;