From a85af56e66b90ae287f8c6d7aa6a11af0887d71d Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 28 Apr 2011 02:15:35 +0000 Subject: When block-capturing a variable with a non-trivial destructor, make sure to mark the destructor. This normally isn't required, because the destructor should have been marked as part of the declaration of the local, but it's necessary when the variable is a parameter because it's the call sites that are responsible for those destructors. llvm-svn: 130372 --- clang/test/CodeGenCXX/blocks.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'clang/test/CodeGenCXX/blocks.cpp') diff --git a/clang/test/CodeGenCXX/blocks.cpp b/clang/test/CodeGenCXX/blocks.cpp index d66debea2b9..a4d5b86565e 100644 --- a/clang/test/CodeGenCXX/blocks.cpp +++ b/clang/test/CodeGenCXX/blocks.cpp @@ -87,3 +87,20 @@ namespace test2 { // CHECK: define internal void @__Block_byref_object_dispose // CHECK: call void @_ZN5test21BD1Ev( } + +// rdar://problem/9334739 +// Make sure we mark destructors for parameters captured in blocks. +namespace test3 { + struct A { + A(const A&); + ~A(); + }; + + struct B : A { + }; + + void test(B b) { + extern void consume(void(^)()); + consume(^{ (void) b; }); + } +} -- cgit v1.2.3