blob: 6d6b3827d73c2930416fab3973a1ea5f4301c11b [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s -pedantic
Chris Lattnerda46f3b2008-01-25 19:37:24 +00002// rdar://5707001
3
4@interface NSNumber;
5- () METH;
Chris Lattnerb93fb492008-06-02 21:31:07 +00006- (unsigned) METH2;
Chris Lattnerda46f3b2008-01-25 19:37:24 +00007@end
8
Chris Lattner0fc73f72008-10-26 23:29:41 +00009struct SomeStruct {
10 int x, y, z, q;
11};
12
Chris Lattner5c749422008-01-25 19:43:26 +000013void test1() {
Chris Lattnerda46f3b2008-01-25 19:37:24 +000014 id objects[] = {[NSNumber METH]};
Chris Lattner5c749422008-01-25 19:43:26 +000015}
16
Chris Lattner2dd979f2009-04-11 19:08:56 +000017void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}}
Steve Naroffccef3712009-02-20 22:59:16 +000018 id objects[] = {[x METH]};
Chris Lattner2b1cc8b2008-07-21 06:12:56 +000019}
20
21void test3(NSNumber *x) {
Chris Lattner5c749422008-01-25 19:43:26 +000022 id objects[] = {[x METH]};
Chris Lattnerda46f3b2008-01-25 19:37:24 +000023}
24
Chris Lattner5c749422008-01-25 19:43:26 +000025
Chris Lattnerb93fb492008-06-02 21:31:07 +000026// rdar://5977581
Chris Lattner2b1cc8b2008-07-21 06:12:56 +000027void test4() {
Chris Lattnerb93fb492008-06-02 21:31:07 +000028 unsigned x[] = {[NSNumber METH2]+2};
29}
30
Chris Lattner0fc73f72008-10-26 23:29:41 +000031void test5(NSNumber *x) {
32 unsigned y[] = {
33 [4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}}
34 [4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}}
35 };
36
37 struct SomeStruct z = {
38 .x = [x METH2], // ok.
39 .x [x METH2] // expected-error {{expected '=' or another designator}}
40 };
41}
Fariborz Jahaniand3fdcb52009-11-06 21:48:47 +000042
43// rdar://7370882
44@interface SemicolonsAppDelegate
45{
46 id i;
47}
48@property (assign) id window;
49@end
50
51@implementation SemicolonsAppDelegate
52{
53 id i;
54}
55 @synthesize window;
56@end
57
58
59