1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
30 int& f(A*); // expected-note {{candidate}}
31 float& f(B*); // expected-note {{candidate}}
37 void test0(A* a, B* b, id val) {
41 // GCC succeeds here, which is clearly ridiculous.
42 float& f2 = f(val); // expected-error {{ambiguous}}
54 B* b = a; // expected-warning{{incompatible pointer types initializing 'B *' with an expression of type 'A *'}}
55 B *c; c = a; // expected-warning{{incompatible pointer types assigning to 'B *' from 'A *'}}
59 B** bp = ap; // expected-warning{{incompatible pointer types initializing 'B **' with an expression of type 'A **'}}
60 bp = ap; // expected-warning{{incompatible pointer types assigning to 'B **' from 'A **'}}
67 float& cv2(const void*);
69 void cv_test(A* a, B* b, const A* ac, const B* bc) {
79 float& qualid(id<P1>);
81 void qualid_test(A *a, B *b, C *c) {
85 float& f1 = qualid(c);
94 void (*throw_exc)(id);
96 objc_exception_functions_t;
98 void (*_NSExceptionRaiser(void))(NSException *) {
99 objc_exception_functions_t exc_funcs;
100 return exc_funcs.throw_exc; // expected-warning{{incompatible pointer types returning 'void (*)(id)' from a function with result type 'void (*)(NSException *)'}}
114 void foo(A*) __attribute__((unavailable)); // expected-note {{marked unavailable here}}
117 foo(b); // expected-error {{'foo' is unavailable}}
121 namespace rdar8714395 {
123 float &f(const Foo*);
125 int &f2(const void*);
126 float &f2(Foo const* const *);
128 int &f3(const void*);
129 float &f3(Foo const**);
140 namespace rdar8734046 {
151 float &f3(const void*);
153 void test_f(B* b, const B* bc) {
162 namespace rdar9327203 {
163 int &f(void* const&, int);
164 float &f(void* const&, long);
172 // it's okay to overload Class with id.
177 @interface NSDictionary<__covariant KeyType, __covariant ObjectType> : A
180 @interface NSMutableDictionary<KeyType, ObjectType> : NSDictionary<KeyType, ObjectType>
183 namespace rdar20124827 {
185 int overload(NSDictionary *) { return 1; }
187 __attribute__((deprecated)) // expected-note {{'overload' has been explicitly marked deprecated here}}
188 int overload(NSMutableDictionary *) { return 0; }
190 __attribute__((deprecated))
191 void overload2(NSDictionary *); // expected-note {{candidate function}}
192 void overload2(NSDictionary<A *, A *> *); // expected-note {{candidate function}}
194 void test(NSDictionary *d1, NSDictionary<A *, A *> *d2, NSMutableDictionary<A *, A *> *m1) {
196 overload(d2); // no warning
197 overload(m1); // expected-warning {{'overload' is deprecated}}
198 overload2(d2); // no warning
199 overload2(m1); // expected-error {{call to 'overload2' is ambiguous}}
204 namespace StringLiterals {
205 void f(const char(&&)[5]);
206 void f(const wchar_t(&&)[5]);
207 void f(const char16_t(&&)[5]);
208 void f(const char32_t(&&)[5]);
211 f({(((@encode(int))))});
216 } // namespace StringLiterals