summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaObjCXX/arc-0x.mm
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaObjCXX/arc-0x.mm')
-rw-r--r--clang/test/SemaObjCXX/arc-0x.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/SemaObjCXX/arc-0x.mm b/clang/test/SemaObjCXX/arc-0x.mm
index be9f1dc2e28..28eec51775b 100644
--- a/clang/test/SemaObjCXX/arc-0x.mm
+++ b/clang/test/SemaObjCXX/arc-0x.mm
@@ -30,3 +30,24 @@ void deduction(id obj) {
} @catch (auto e) { // expected-error {{'auto' not allowed in exception declaration}}
}
}
+
+// rdar://problem/11068137
+void test1a() {
+ __autoreleasing id p; // expected-note 2 {{'p' declared here}}
+ (void) [&p] {};
+ (void) [p] {}; // expected-error {{cannot capture __autoreleasing variable in a lambda by copy}}
+ (void) [=] { (void) p; }; // expected-error {{cannot capture __autoreleasing variable in a lambda by copy}}
+}
+void test1b() {
+ __autoreleasing id v;
+ __autoreleasing id &p = v; // expected-note 2 {{'p' declared here}}
+ (void) [&p] {};
+ (void) [p] {}; // expected-error {{cannot capture __autoreleasing variable in a lambda by copy}}
+ (void) [=] { (void) p; }; // expected-error {{cannot capture __autoreleasing variable in a lambda by copy}}
+}
+void test1c() {
+ __autoreleasing id v; // expected-note {{'v' declared here}}
+ __autoreleasing id &p = v;
+ (void) ^{ (void) p; };
+ (void) ^{ (void) v; }; // expected-error {{cannot capture __autoreleasing variable in a block}}
+}
OpenPOWER on IntegriCloud