[libcxx] r273342 - Allow placement new array test to consume extra bytes as specified by the standard.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 21 17:32:28 PDT 2016
Author: ericwf
Date: Tue Jun 21 19:32:28 2016
New Revision: 273342
URL: http://llvm.org/viewvc/llvm-project?rev=273342&view=rev
Log:
Allow placement new array test to consume extra bytes as specified by the standard.
Modified:
libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
Modified: libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp?rev=273342&r1=273341&r2=273342&view=diff
==============================================================================
--- libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp (original)
+++ libcxx/trunk/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_array.pass.cpp Tue Jun 21 19:32:28 2016
@@ -22,9 +22,13 @@ struct A
int main()
{
- char buf[3*sizeof(A)];
+ const std::size_t Size = 3;
+ // placement new might require additional space.
+ const std::size_t ExtraSize = 64;
+ char buf[Size*sizeof(A) + ExtraSize];
- A* ap = new(buf) A[3];
- assert((char*)ap == buf);
- assert(A_constructed == 3);
+ A* ap = new(buf) A[Size];
+ assert((char*)ap >= buf);
+ assert((char*)ap < (buf + ExtraSize));
+ assert(A_constructed == Size);
}
More information about the cfe-commits
mailing list