diff options
author | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
---|---|---|
committer | Zancanaro; Carlo <czan8762@plang3.cs.usyd.edu.au> | 2012-09-24 09:58:17 +1000 |
commit | 222e2a7620e6520ffaf4fc4e69d79c18da31542e (patch) | |
tree | 7bfbc05bfa3b41c8f9d2e56d53a0bc3e310df239 /clang/test/SemaObjC/protocol-id-test-3.m | |
parent | 3d206f03985b50beacae843d880bccdc91a9f424 (diff) |
Add the clang library to the repo (with some of my changes, too).
Diffstat (limited to 'clang/test/SemaObjC/protocol-id-test-3.m')
-rw-r--r-- | clang/test/SemaObjC/protocol-id-test-3.m | 94 |
1 files changed, 94 insertions, 0 deletions
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<MyProto1> Func(INTF <MyProto1, MyProto2> *p2) // expected-note 2{{passing argument to parameter 'p2' here}} +{ + return p2; +} + + + + + id<MyProto1> Gunc(id <MyProto1, MyProto2>p2) +{ + return p2; +} + + + id<MyProto1> Gunc1(id <MyProto1, MyProto2>p2) +{ + return p2; +} + +id<MyProto1, MyProto2> Gunc2(id <MyProto1>p2) +{ + Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}} + return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'id<MyProto1,MyProto2>'}} +} + + + +id<MyProto1> Gunc3(id <MyProto2>p2) +{ + return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'id<MyProto1>'}} +} + + +id<MyProto1, MyProto2> Gunc4(id <MyProto2, MyProto1>p2) +{ + return p2; +} + + + +INTF<MyProto1> * Hunc(id <MyProto1, MyProto2>p2) +{ + return p2; +} + + +INTF<MyProto1> * Hunc1(id <MyProto1, MyProto2>p2) +{ + return p2; +} + +INTF<MyProto1, MyProto2> * Hunc2(id <MyProto1>p2) +{ + Func(p2); // expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}} + return p2; // expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'INTF<MyProto1,MyProto2> *'}} +} + +INTF<MyProto1> * Hunc3(id <MyProto2>p2) +{ + return p2; // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'INTF<MyProto1> *'}} +} + + +INTF<MyProto1, MyProto2> * Hunc4(id <MyProto2, MyProto1>p2) +{ + return p2; +} + +id Iunc(id <MyProto1, MyProto2>p2) +{ + return p2; +} + + +id<MyProto1> Iunc1(id p2) +{ + return p2; +} + +id<MyProto1, MyProto2> Iunc2(id p2) +{ + Iunc(p2); + return p2; +} |