From 561a94c8c65094ca9ae1af4bb61700b355a86bc2 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 13 Oct 2007 23:18:35 +0000 Subject: [PATCH] Merge with the offending files removed. [SVN r39995] --- include/boost/utility/typed_in_place_factory.hpp | 4 ++-- include/boost/utility/value_init.hpp | 12 ++++++++++-- value_init_test.cpp | 3 +++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/include/boost/utility/typed_in_place_factory.hpp b/include/boost/utility/typed_in_place_factory.hpp index f5de755..347b7f4 100644 --- a/include/boost/utility/typed_in_place_factory.hpp +++ b/include/boost/utility/typed_in_place_factory.hpp @@ -54,8 +54,8 @@ public: void* apply (void* address, std::size_t n) const { - for(char* next = address = this->apply(address); !! --n;) - this->apply(next = next+sizeof(T)); + for(void* next = address = this->apply(address); !! --n;) + this->apply(next = static_cast(next) + sizeof(T)); return address; } diff --git a/include/boost/utility/value_init.hpp b/include/boost/utility/value_init.hpp index a564658..4cd8e1b 100644 --- a/include/boost/utility/value_init.hpp +++ b/include/boost/utility/value_init.hpp @@ -46,7 +46,11 @@ class const_T_base new (&x) T(); } - ~const_T_base() { get().T::~T(); } + ~const_T_base() + { + void const * ptr = &x; + static_cast(ptr)->T::~T(); + } T & get() const { @@ -69,7 +73,11 @@ class non_const_T_base new (&x) T(); } - ~non_const_T_base() { get().T::~T(); } + ~non_const_T_base() + { + void * ptr = &x; + static_cast(ptr)->T::~T(); + } T & get() const { diff --git a/value_init_test.cpp b/value_init_test.cpp index fe73cc1..08f9b87 100644 --- a/value_init_test.cpp +++ b/value_init_test.cpp @@ -95,6 +95,9 @@ int test_main(int, char **) test( POD(0,0,0.0), POD('a',1234,56.78) ) ; test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ; + NonPOD NonPOD_object( std::string("NonPOD_object") ); + test( 0, &NonPOD_object ) ; + return 0; }