1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // test placement new array 11 12 #include <new> 13 #include <cassert> 14 15 int A_constructed = 0; 16 17 struct A 18 { AA19 A() {++A_constructed;} ~AA20 ~A() {--A_constructed;} 21 }; 22 main()23int main() 24 { 25 char buf[3*sizeof(A)]; 26 27 A* ap = new(buf) A[3]; 28 assert((char*)ap == buf); 29 assert(A_constructed == 3); 30 } 31