blob: 03f28a1b586a01f96b98845023d959df2fb70756 [file] [log] [blame]
Nick Lewyckyba5f6ec2010-04-24 01:30:46 +00001// RUN: cp %s %t
2// RUN: %clang_cc1 -pedantic -fixit -x objective-c %t
3// RUN: %clang_cc1 -pedantic -verify -x objective-c %t
Anders Carlssonb76cd3d2009-11-10 04:46:30 +00004
5/* This is a test of the various code modification hints that are
6 provided as part of warning or extension diagnostics. All of the
7 warnings will be fixed by -fixit, and the resulting file should
8 compile cleanly with -Werror -pedantic. */
Chris Lattner75e36062009-04-03 18:38:42 +00009
10@protocol X;
11
12void foo() {
13 <X> *P; // should be fixed to 'id<X>'.
14}
Anders Carlssonb76cd3d2009-11-10 04:46:30 +000015
16@class A;
17@class NSString;
18
19@interface Test
20- (void)test:(NSString *)string;
21
22@property (copy) NSString *property;
23@end
24
25void g(NSString *a);
26void h(id a);
27
28void f(Test *t) {
29 NSString *a = "Foo";
30 id b = "Foo";
Douglas Gregor08a41902010-04-09 17:53:29 +000031 A* c = "Foo"; // expected-warning {{incompatible pointer types initializing 'A *' with an expression of type 'char [4]'}}
Anders Carlssonb76cd3d2009-11-10 04:46:30 +000032 g("Foo");
33 h("Foo");
34 h(("Foo"));
35 [t test:"Foo"];
36 t.property = "Foo";
37}