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 11 12#include <new> 13#include <cassert> 14 15int A_constructed = 0; 16 17struct A 18{ 19 A() {++A_constructed;} 20 ~A() {--A_constructed;} 21}; 22 23int main() 24{ 25 char buf[sizeof(A)]; 26 27 A* ap = new(buf) A; 28 assert((char*)ap == buf); 29 assert(A_constructed == 1); 30} 31