diff options
| author | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-04 21:28:44 +0000 |
|---|---|---|
| committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-08-04 21:28:44 +0000 |
| commit | 6a868441612b2ac607b63dc95f2710c400fbc54c (patch) | |
| tree | d57b52045e2cf38878b734869a46b78f34adace3 /clang/test/SemaObjC/qualified-protocol-method-conflicts.m | |
| parent | 2c23b27fc780819e6ea48f6cba2b20613dfd92be (diff) | |
| download | bcm5719-llvm-6a868441612b2ac607b63dc95f2710c400fbc54c.tar.gz bcm5719-llvm-6a868441612b2ac607b63dc95f2710c400fbc54c.zip | |
objective-c: diagnose protocol inconsistencies in following
situation. When a class explicitly or implicitly (through inheritance)
"conformsTo" two protocols which conflict (have methods which conflict).
This is 2nd part of // rdar://6191214.
llvm-svn: 136927
Diffstat (limited to 'clang/test/SemaObjC/qualified-protocol-method-conflicts.m')
| -rw-r--r-- | clang/test/SemaObjC/qualified-protocol-method-conflicts.m | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/clang/test/SemaObjC/qualified-protocol-method-conflicts.m b/clang/test/SemaObjC/qualified-protocol-method-conflicts.m new file mode 100644 index 00000000000..676a34b7384 --- /dev/null +++ b/clang/test/SemaObjC/qualified-protocol-method-conflicts.m @@ -0,0 +1,43 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s +// rdar://6191214 + +@protocol Xint +-(void) setX: (int) arg0; // expected-warning 2 {{conflicting parameter types in declaration of 'setX:': 'float' vs 'int'}} \ + // expected-note {{previous definition is here}} ++(int) C; // expected-warning 2 {{conflicting return type in declaration of 'C': 'float' vs 'int'}} \ + // expected-note {{previous definition is here}} +@end + +@protocol Xfloat +-(void) setX: (float) arg0; // expected-note 2 {{previous definition is here}} \ + // expected-warning {{conflicting parameter types in declaration of 'setX:': 'int' vs 'float'}} ++(float) C; // expected-warning {{conflicting return type in declaration of 'C': 'int' vs 'float'}} \ + // expected-note 2 {{previous definition is here}} +@end + +@interface A <Xint, Xfloat> // expected-note {{class is declared here}} +@end + +@implementation A +-(void) setX: (int) arg0 { } ++(int) C {return 0; } +@end + +@interface B <Xfloat, Xint> // expected-note {{class is declared here}} +@end + +@implementation B +-(void) setX: (float) arg0 { } ++ (float) C {return 0.0; } +@end + +@protocol Xint_float<Xint, Xfloat> +@end + +@interface C<Xint_float> // expected-note {{class is declared here}} +@end + +@implementation C +-(void) setX: (int) arg0 { } ++ (int) C {return 0;} +@end |

