diff options
Diffstat (limited to 'test/SemaObjC/incompatible-protocol-qualified-types.m')
-rw-r--r-- | test/SemaObjC/incompatible-protocol-qualified-types.m | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/test/SemaObjC/incompatible-protocol-qualified-types.m b/test/SemaObjC/incompatible-protocol-qualified-types.m new file mode 100644 index 000000000000..862265ca6476 --- /dev/null +++ b/test/SemaObjC/incompatible-protocol-qualified-types.m @@ -0,0 +1,40 @@ +// RUN: clang-cc -pedantic -fsyntax-only -verify %s + +@protocol MyProto1 +@end + +@protocol MyProto2 +@end + +@interface INTF @end + +INTF <MyProto1> * Func(INTF <MyProto1, MyProto2> *p2) +{ + return p2; +} + + +INTF <MyProto1> * Func1(INTF <MyProto1, MyProto2> *p2) +{ + return p2; +} + +INTF <MyProto1, MyProto2> * Func2(INTF <MyProto1> *p2) +{ + Func(p2); // expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}} + return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}} +} + + + +INTF <MyProto1> * Func3(INTF <MyProto2> *p2) +{ + return p2; // expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *', expected 'INTF<MyProto1> *}} +} + + +INTF <MyProto1, MyProto2> * Func4(INTF <MyProto2, MyProto1> *p2) +{ + return p2; +} + |