aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCXX/blocks.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2013-03-22 02:10:40 +0000
committerJohn McCall <rjmccall@apple.com>2013-03-22 02:10:40 +0000
commitb760f11fae94e3003b9241ac50c02617465f2fa2 (patch)
treed0709d70ccbe6150d35452e68660bde46efe7e40 /test/CodeGenCXX/blocks.cpp
parentbf8487a3c290203ae54fd81d35a94be0ff211235 (diff)
Fix a crash-on-valid where a block capture copy expression was
picking up cleanups from earlier in the statement. Also fix a crash-on-invalid where a reference to an invalid decl from an enclosing scope was causing an expression to fail to build, but only *after* a cleanup was registered from that statement, causing an assertion downstream. The crash-on-valid is rdar://13459289. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177692 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/blocks.cpp')
-rw-r--r--test/CodeGenCXX/blocks.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGenCXX/blocks.cpp b/test/CodeGenCXX/blocks.cpp
index 209213999e..914c0695cc 100644
--- a/test/CodeGenCXX/blocks.cpp
+++ b/test/CodeGenCXX/blocks.cpp
@@ -228,3 +228,28 @@ namespace test8 {
template int X::foo<int>();
}
+
+// rdar://13459289
+namespace test9 {
+ struct B {
+ void *p;
+ B();
+ B(const B&);
+ ~B();
+ };
+
+ void use_block(void (^)());
+ void use_block_2(void (^)(), const B &a);
+
+ // Ensuring that creating a non-trivial capture copy expression
+ // doesn't end up stealing the block registration for the block we
+ // just parsed. That block must have captures or else it won't
+ // force registration. Must occur within a block for some reason.
+ void test() {
+ B x;
+ use_block(^{
+ int y;
+ use_block_2(^{ (void)y; }, x);
+ });
+ }
+}