diff options
-rw-r--r-- | clang/test/Sema/objc-types-compatible.m | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/clang/test/Sema/objc-types-compatible.m b/clang/test/Sema/objc-types-compatible.m index a07962bf08b..bd8a7490c41 100644 --- a/clang/test/Sema/objc-types-compatible.m +++ b/clang/test/Sema/objc-types-compatible.m @@ -1,4 +1,4 @@ -// RUN: clang -fsyntax-only -verify %s +// RUN: clang -fsyntax-only -verify -pedantic %s typedef signed char BOOL; typedef int NSInteger; @@ -14,3 +14,27 @@ extern NSInteger codeAssistantCaseCompareItems(id a, id b, void *context); NSInteger codeAssistantCaseCompareItems(id<PBXCompletionItem> a, id<PBXCompletionItem> b, void *context) { } + +#if 0 +FIXME: clang needs to compare each method prototype with its definition (see below). + +GCC produces the following correct warnning: +[snaroff:llvm/tools/clang] snarofflocal% cc -c test/Sema/objc-types-compatible.m +test/Sema/objc-types-compatible.m: In function ‘-[TedWantsToVerifyObjCDoesTheRightThing compareThis:withThat:]’: +test/Sema/objc-types-compatible.m:26: warning: conflicting types for ‘-(id)compareThis:(id <PBXCompletionItem>)a withThat:(id <PBXCompletionItem>)b’ +test/Sema/objc-types-compatible.m:20: warning: previous declaration of ‘-(id)compareThis:(int)a withThat:(id)b’ +#endif + +@interface TedWantsToVerifyObjCDoesTheRightThing + +- compareThis:(int)a withThat:(id)b; + +@end + +@implementation TedWantsToVerifyObjCDoesTheRightThing + +- compareThis:(id<PBXCompletionItem>)a withThat:(id<PBXCompletionItem>)b { + return self; +} + +@end |