1 // RUN: clang-cc %s -emit-llvm -o %t &&
2 
3 void t1() {
4   int* a = new int;
5 }
6 
7 // Placement.
8 void* operator new(unsigned long, void*) throw();
9 
10 void t2(int* a) {
11   int* b = new (a) int;
12 }
13 
14 struct S {
15   int a;
16 };
17 
18 // POD types.
19 void t3() {
20   int *a = new int(10);
21   _Complex int* b = new _Complex int(10i);
22 
23   S s;
24   s.a = 10;
25   S *sp = new S(s);
26 }
27 
28 // Non-POD
29 struct T {
30   T();
31   int a;
32 };
33 
34 void t4() {
35   // RUN: grep "call void @_ZN1TC1Ev" %t | count 1 &&
36   T *t = new T;
37 }
38 
39 struct T2 {
40   int a;
41   T2(int, int);
42 };
43 
44 void t5() {
45   // RUN: grep "call void @_ZN2T2C1Eii" %t | count 1
46   T2 *t2 = new T2(10, 10);
47 }
48 
49 int *t6() {
50   // Null check.
51   return new (0) int(10);
52 }
53 
54 void t7() {
55   new int();
56 }
57