diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-29 18:26:21 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2010-10-29 18:26:21 +0000 |
| commit | 531a3707a9984ef23da0fddbd233ed33221a1444 (patch) | |
| tree | 6abdfd37f87e1d339b750653d17dfae7c8efabbe /clang/test/SemaObjC | |
| parent | 0cce30fd3483980aa75c33b4c3dea3551f326ec0 (diff) | |
| download | bcm5719-llvm-531a3707a9984ef23da0fddbd233ed33221a1444.tar.gz bcm5719-llvm-531a3707a9984ef23da0fddbd233ed33221a1444.zip | |
Qualified 'id' should implement all of static class type's
protocols, including those added to class, super class
and categories; otherewise issue a warning. This fixes
pr8453.
llvm-svn: 117678
Diffstat (limited to 'clang/test/SemaObjC')
| -rw-r--r-- | clang/test/SemaObjC/comptypes-10.m | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/comptypes-10.m b/clang/test/SemaObjC/comptypes-10.m new file mode 100644 index 00000000000..0a2219099fb --- /dev/null +++ b/clang/test/SemaObjC/comptypes-10.m @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +//rdar: //8591619 +// pr8453 + +@protocol NSCopying @end +@protocol NSPROTO @end +@protocol NSPROTO1 @end +@protocol NSPROTO2 @end + +@interface NSObject <NSCopying, NSPROTO, NSPROTO1> { + Class isa; +} +@end + +void gorf(NSObject <NSCopying> *); // expected-note {{passing argument to parameter here}} + +NSObject <NSCopying> *foo(id <NSCopying> bar, id id_obj) +{ + NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying>'}} + NSObject *Init1 = bar; // expected-warning {{initializing 'NSObject *' with an expression of incompatible type 'id<NSCopying>'}} + + NSObject <NSCopying> *I = id_obj; + NSObject *I1 = id_obj; + gorf(bar); // expected-warning {{passing 'id<NSCopying>' to parameter of incompatible type 'NSObject<NSCopying> *'}} + + gorf(id_obj); + + return bar; // expected-warning {{returning 'id<NSCopying>' from a function with incompatible result type 'NSObject<NSCopying> *'}} +} + +void test(id <NSCopying, NSPROTO, NSPROTO2> bar) +{ + NSObject <NSCopying> *Init = bar; // expected-warning {{initializing 'NSObject<NSCopying> *' with an expression of incompatible type 'id<NSCopying,NSPROTO,NSPROTO2>'}} +} |

