blob: c9d7d5d301ea615c37b5958262c42c760991c6be [file] [log] [blame]
John McCall260611a2012-06-20 06:18:46 +00001// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -pedantic -Wno-objc-root-class %s
2// RUN: %clang_cc1 -fsyntax-only -fobjc-runtime=macosx-fragile -verify -x objective-c++ -Wno-objc-root-class %s
Chris Lattnerda46f3b2008-01-25 19:37:24 +00003// rdar://5707001
4
5@interface NSNumber;
6- () METH;
Chris Lattnerb93fb492008-06-02 21:31:07 +00007- (unsigned) METH2;
Chris Lattnerda46f3b2008-01-25 19:37:24 +00008@end
9
Chris Lattner0fc73f72008-10-26 23:29:41 +000010struct SomeStruct {
11 int x, y, z, q;
12};
13
Chris Lattner5c749422008-01-25 19:43:26 +000014void test1() {
Chris Lattnerda46f3b2008-01-25 19:37:24 +000015 id objects[] = {[NSNumber METH]};
Chris Lattner5c749422008-01-25 19:43:26 +000016}
17
Richard Trieu2fe9b7f2011-12-15 00:38:15 +000018void test2(NSNumber x) { // expected-error {{interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
Steve Naroffccef3712009-02-20 22:59:16 +000019 id objects[] = {[x METH]};
Chris Lattner2b1cc8b2008-07-21 06:12:56 +000020}
21
22void test3(NSNumber *x) {
Chris Lattner5c749422008-01-25 19:43:26 +000023 id objects[] = {[x METH]};
Chris Lattnerda46f3b2008-01-25 19:37:24 +000024}
25
Chris Lattner5c749422008-01-25 19:43:26 +000026
Chris Lattnerb93fb492008-06-02 21:31:07 +000027// rdar://5977581
Chris Lattner2b1cc8b2008-07-21 06:12:56 +000028void test4() {
Chris Lattnerb93fb492008-06-02 21:31:07 +000029 unsigned x[] = {[NSNumber METH2]+2};
30}
31
Chris Lattner0fc73f72008-10-26 23:29:41 +000032void test5(NSNumber *x) {
33 unsigned y[] = {
34 [4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}}
35 [4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}}
36 };
37
38 struct SomeStruct z = {
39 .x = [x METH2], // ok.
40 .x [x METH2] // expected-error {{expected '=' or another designator}}
41 };
42}
Fariborz Jahaniand3fdcb52009-11-06 21:48:47 +000043
44// rdar://7370882
45@interface SemicolonsAppDelegate
46{
47 id i;
48}
49@property (assign) id window;
50@end
51
52@implementation SemicolonsAppDelegate
53{
54 id i;
55}
Fariborz Jahanian8a389b62009-11-06 22:15:27 +000056 @synthesize window=i;
Fariborz Jahaniand3fdcb52009-11-06 21:48:47 +000057@end
58
59
60