2009-12-17 07:13:33 +08:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
typedef const void * VoidStar;
typedef struct __CFDictionary * CFMDRef;
void RandomFunc(CFMDRef theDict, const void *key, const void *value);
@interface Foo
- (void)_apply:(void (*)(const void *, const void *, void *))func context:(void *)context;
- (void)a:(id *)objects b:(id *)keys;
@end
@implementation Foo
- (void)_apply:(void (*)(const void *, const void *, void *))func context:(void *)context {
id item;
id obj;
func(item, obj, context);
}
- (void)a:(id *)objects b:(id *)keys {
VoidStar dict;
id key;
RandomFunc((CFMDRef)dict, key, objects[3]);
}
@end
2010-03-16 02:36:00 +08:00
@interface I
2010-04-22 08:20:18 +08:00
- (void) Meth : (I*) Arg; // expected-note{{passing argument to parameter 'Arg' here}}
2010-03-16 02:36:00 +08:00
@end
void Func (I* arg); // expected-note {{candidate function not viable: no known conversion from 'I const *' to 'I *' for 1st argument}}
void foo(const I *p, I* sel) {
2010-04-22 07:24:10 +08:00
[sel Meth : p]; // expected-error {{cannot initialize a parameter of type 'I *' with an lvalue of type 'I const *'}}
2010-03-16 02:36:00 +08:00
Func(p); // expected-error {{no matching function for call to 'Func'}}
}
2010-07-01 07:01:39 +08:00
@interface DerivedFromI : I
@end
2010-07-01 10:14:45 +08:00
void accept_derived(DerivedFromI*); // expected-note{{candidate function not viable: cannot convert from superclass 'I *' to subclass 'DerivedFromI *' for 1st argument}}
2010-07-01 07:01:39 +08:00
void test_base_to_derived(I* i) {
accept_derived(i); // expected-error{{no matching function for call to 'accept_derived'}}
}