From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- clang/test/SemaObjC/protocol-id-test-3.m | 94 ++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 clang/test/SemaObjC/protocol-id-test-3.m (limited to 'clang/test/SemaObjC/protocol-id-test-3.m') diff --git a/clang/test/SemaObjC/protocol-id-test-3.m b/clang/test/SemaObjC/protocol-id-test-3.m new file mode 100644 index 0000000..624bab0 --- /dev/null +++ b/clang/test/SemaObjC/protocol-id-test-3.m @@ -0,0 +1,94 @@ +// RUN: %clang_cc1 -pedantic -fsyntax-only -verify %s + +@protocol MyProto1 +@end + +@protocol MyProto2 +@end + +@interface INTF @end + +id Func(INTF *p2) // expected-note 2{{passing argument to parameter 'p2' here}} +{ + return p2; +} + + + + + id Gunc(id p2) +{ + return p2; +} + + + id Gunc1(id p2) +{ + return p2; +} + +id Gunc2(id p2) +{ + Func(p2); // expected-warning {{passing 'id' to parameter of incompatible type 'INTF *'}} + return p2; // expected-warning {{returning 'id' from a function with incompatible result type 'id'}} +} + + + +id Gunc3(id p2) +{ + return p2; // expected-warning {{returning 'id' from a function with incompatible result type 'id'}} +} + + +id Gunc4(id p2) +{ + return p2; +} + + + +INTF * Hunc(id p2) +{ + return p2; +} + + +INTF * Hunc1(id p2) +{ + return p2; +} + +INTF * Hunc2(id p2) +{ + Func(p2); // expected-warning {{passing 'id' to parameter of incompatible type 'INTF *'}} + return p2; // expected-warning {{returning 'id' from a function with incompatible result type 'INTF *'}} +} + +INTF * Hunc3(id p2) +{ + return p2; // expected-warning {{returning 'id' from a function with incompatible result type 'INTF *'}} +} + + +INTF * Hunc4(id p2) +{ + return p2; +} + +id Iunc(id p2) +{ + return p2; +} + + +id Iunc1(id p2) +{ + return p2; +} + +id Iunc2(id p2) +{ + Iunc(p2); + return p2; +} -- cgit v1.2.3