Is previously initialize memory guaranteed to persist after a placement new call?

Viewed 192

Say I have the following:

struct A
{
   int x;
};

//...
A* aOriginal = new A();  //value construct aOriginal
assert( aOriginal->x == 0 );

A* aSecond = new (aOriginal) A;
assert( aSecond->x == 0 );

Is the second assert guaranteed to hold, even though aSecond is not value-initialized? Logically, it should, because the memory isn't overwritten, but is it specified by the standard?

1 Answers
Related