diagnose attempts to return objc interfaces by-value from C functions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68873 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index fe14287..7345402 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -31,6 +31,13 @@
return bar6(objectCreationBlock); // expected-warning{{incompatible block pointer types passing 'id (^)()', expected 'id (^)(int)'}}
}
-void foo67(id (^x)(int)) {
+void foo7(id (^x)(int)) {
if (x) { }
}
+
+@interface itf
+@end
+
+void foo8() {
+ ^(itf x) {};
+}
diff --git a/test/SemaObjC/invalid-objc-decls-1.m b/test/SemaObjC/invalid-objc-decls-1.m
index 1ef22a0..540000b 100644
--- a/test/SemaObjC/invalid-objc-decls-1.m
+++ b/test/SemaObjC/invalid-objc-decls-1.m
@@ -27,7 +27,8 @@
}
@end
-Super foo(Super parm1) { // expected-error{{Objective-C interface type 'Super' cannot be passed by value}}
+Super foo( // expected-error{{Objective-C interface type 'Super' cannot be returned by value}}
+ Super parm1) { // expected-error{{Objective-C interface type 'Super' cannot be passed by value}}
Super p1; // expected-error{{Objective-C type cannot be statically allocated}}
return p1;
}
diff --git a/test/SemaObjC/method-bad-param.m b/test/SemaObjC/method-bad-param.m
index 3667427..824f72d 100644
--- a/test/SemaObjC/method-bad-param.m
+++ b/test/SemaObjC/method-bad-param.m
@@ -21,3 +21,4 @@
@end
void somefunc(foo x) {} // expected-error {{Objective-C interface type 'foo' cannot be passed by value}}
+foo somefunc2() {} // expected-error {{Objective-C interface type 'foo' cannot be returned by value}}