diff options
| author | Ed Schouten <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
|---|---|---|
| committer | Ed Schouten <ed@FreeBSD.org> | 2009-06-02 17:58:47 +0000 |
| commit | ec2b103c267a06a66e926f62cd96767b280f5cf5 (patch) | |
| tree | ce7d964cbb5e39695b71481698f10cb099c23d4a /test/CodeGenCXX/new.cpp | |
Notes
Diffstat (limited to 'test/CodeGenCXX/new.cpp')
| -rw-r--r-- | test/CodeGenCXX/new.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/CodeGenCXX/new.cpp b/test/CodeGenCXX/new.cpp new file mode 100644 index 000000000000..480bbcefc08d --- /dev/null +++ b/test/CodeGenCXX/new.cpp @@ -0,0 +1,56 @@ +// RUN: clang-cc %s -emit-llvm -o %t && + +void t1() { + int* a = new int; +} + +// Placement. +void* operator new(unsigned long, void*) throw(); + +void t2(int* a) { + int* b = new (a) int; +} + +struct S { + int a; +}; + +// POD types. +void t3() { + int *a = new int(10); + _Complex int* b = new _Complex int(10i); + + S s; + s.a = 10; + S *sp = new S(s); +} + +// Non-POD +struct T { + T(); + int a; +}; + +void t4() { + // RUN: grep "call void @_ZN1TC1Ev" %t | count 1 && + T *t = new T; +} + +struct T2 { + int a; + T2(int, int); +}; + +void t5() { + // RUN: grep "call void @_ZN2T2C1Eii" %t | count 1 + T2 *t2 = new T2(10, 10); +} + +int *t6() { + // Null check. + return new (0) int(10); +} + +void t7() { + new int(); +} |
