Anders Carlsson | ed4e367 | 2009-05-31 20:21:44 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -emit-llvm -o %t |
2 | |||||
3 | void t1() { | ||||
4 | int* a = new int; | ||||
5 | } | ||||
Anders Carlsson | d958389 | 2009-05-31 20:26:12 +0000 | [diff] [blame] | 6 | |
7 | // Placement. | ||||
8 | void* operator new(unsigned long, void*) throw(); | ||||
9 | |||||
10 | void t2(int* a) { | ||||
11 | int* b = new (a) int; | ||||
12 | } | ||||
Anders Carlsson | 6d0ffad | 2009-05-31 20:56:36 +0000 | [diff] [blame] | 13 | |
Anders Carlsson | 627a3e5 | 2009-05-31 21:12:26 +0000 | [diff] [blame^] | 14 | struct S { |
15 | int a; | ||||
16 | }; | ||||
17 | |||||
Anders Carlsson | 6d0ffad | 2009-05-31 20:56:36 +0000 | [diff] [blame] | 18 | void t3() { |
19 | int *a = new int(10); | ||||
Anders Carlsson | 3923e95 | 2009-05-31 21:07:58 +0000 | [diff] [blame] | 20 | _Complex int* b = new _Complex int(10i); |
21 | |||||
Anders Carlsson | 627a3e5 | 2009-05-31 21:12:26 +0000 | [diff] [blame^] | 22 | S s; |
23 | s.a = 10; | ||||
24 | S *sp = new S(s); | ||||
Anders Carlsson | 6d0ffad | 2009-05-31 20:56:36 +0000 | [diff] [blame] | 25 | } |