Merge with the offending files removed.

[SVN r39995]
This commit is contained in:
Daniel James
2007-10-13 23:18:35 +00:00
parent 9ddcf04abc
commit 561a94c8c6
3 changed files with 15 additions and 4 deletions

View File

@ -54,8 +54,8 @@ public:
void* apply (void* address, std::size_t n) const void* apply (void* address, std::size_t n) const
{ {
for(char* next = address = this->apply(address); !! --n;) for(void* next = address = this->apply(address); !! --n;)
this->apply(next = next+sizeof(T)); this->apply(next = static_cast<char *>(next) + sizeof(T));
return address; return address;
} }

View File

@ -46,7 +46,11 @@ class const_T_base
new (&x) T(); new (&x) T();
} }
~const_T_base() { get().T::~T(); } ~const_T_base()
{
void const * ptr = &x;
static_cast<T*>(ptr)->T::~T();
}
T & get() const T & get() const
{ {
@ -69,7 +73,11 @@ class non_const_T_base
new (&x) T(); new (&x) T();
} }
~non_const_T_base() { get().T::~T(); } ~non_const_T_base()
{
void * ptr = &x;
static_cast<T*>(ptr)->T::~T();
}
T & get() const T & get() const
{ {

View File

@ -95,6 +95,9 @@ int test_main(int, char **)
test( POD(0,0,0.0), POD('a',1234,56.78) ) ; test( POD(0,0,0.0), POD('a',1234,56.78) ) ;
test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ; test( NonPOD( std::string() ), NonPOD( std::string("something") ) ) ;
NonPOD NonPOD_object( std::string("NonPOD_object") );
test<NonPOD *>( 0, &NonPOD_object ) ;
return 0; return 0;
} }