aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/exceptions.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:49:41 +0000
commit45b533945f0851ec234ca846e1af5ee1e4df0b6e (patch)
tree0a5b74c0b9ca73aded34df95c91fcaf3815230d8 /test/CodeGenCXX/exceptions.cpp
parent7e86edd64bfae4e324224452e4ea879b3371a4bd (diff)
Notes
Diffstat (limited to 'test/CodeGenCXX/exceptions.cpp')
-rw-r--r--test/CodeGenCXX/exceptions.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/test/CodeGenCXX/exceptions.cpp b/test/CodeGenCXX/exceptions.cpp
index e8f6c7996a16..ff76b11350db 100644
--- a/test/CodeGenCXX/exceptions.cpp
+++ b/test/CodeGenCXX/exceptions.cpp
@@ -1,6 +1,9 @@
// RUN: %clang_cc1 %s -triple=x86_64-linux-gnu -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
-typedef typeof(sizeof(0)) size_t;
+typedef __typeof(sizeof(0)) size_t;
+
+// Declare the reserved global placement new.
+void *operator new(size_t, void*);
// This just shouldn't crash.
namespace test0 {
@@ -526,4 +529,21 @@ namespace test11 {
// (After this is a terminate landingpad.)
}
+namespace test12 {
+ struct A {
+ void operator delete(void *, void *);
+ A();
+ };
+
+ A *test(void *ptr) {
+ return new (ptr) A();
+ }
+ // CHECK-LABEL: define {{.*}} @_ZN6test124testEPv(
+ // CHECK: [[PTR:%.*]] = load i8*, i8*
+ // CHECK-NEXT: [[CAST:%.*]] = bitcast i8* [[PTR]] to [[A:%.*]]*
+ // CHECK-NEXT: invoke void @_ZN6test121AC1Ev([[A]]* [[CAST]])
+ // CHECK: ret [[A]]* [[CAST]]
+ // CHECK: invoke void @_ZN6test121AdlEPvS1_(i8* [[PTR]], i8* [[PTR]])
+}
+
// CHECK: attributes [[NI_NR_NUW]] = { noinline noreturn nounwind }