2011-10-02 09:16:38 +08:00
|
|
|
// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify %s -pedantic
|
|
|
|
// RUN: %clang_cc1 -fsyntax-only -fobjc-fragile-abi -verify -x objective-c++ %s
|
2008-01-26 03:37:24 +08:00
|
|
|
// rdar://5707001
|
|
|
|
|
|
|
|
@interface NSNumber;
|
|
|
|
- () METH;
|
2008-06-03 05:31:07 +08:00
|
|
|
- (unsigned) METH2;
|
2008-01-26 03:37:24 +08:00
|
|
|
@end
|
|
|
|
|
2008-10-27 07:29:41 +08:00
|
|
|
struct SomeStruct {
|
|
|
|
int x, y, z, q;
|
|
|
|
};
|
|
|
|
|
2008-01-26 03:43:26 +08:00
|
|
|
void test1() {
|
2008-01-26 03:37:24 +08:00
|
|
|
id objects[] = {[NSNumber METH]};
|
2008-01-26 03:43:26 +08:00
|
|
|
}
|
|
|
|
|
2010-04-07 08:22:00 +08:00
|
|
|
void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value; did you forget * in 'NSNumber'}}
|
2009-02-21 06:59:16 +08:00
|
|
|
id objects[] = {[x METH]};
|
2008-07-21 14:12:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void test3(NSNumber *x) {
|
2008-01-26 03:43:26 +08:00
|
|
|
id objects[] = {[x METH]};
|
2008-01-26 03:37:24 +08:00
|
|
|
}
|
|
|
|
|
2008-01-26 03:43:26 +08:00
|
|
|
|
2008-06-03 05:31:07 +08:00
|
|
|
// rdar://5977581
|
2008-07-21 14:12:56 +08:00
|
|
|
void test4() {
|
2008-06-03 05:31:07 +08:00
|
|
|
unsigned x[] = {[NSNumber METH2]+2};
|
|
|
|
}
|
|
|
|
|
2008-10-27 07:29:41 +08:00
|
|
|
void test5(NSNumber *x) {
|
|
|
|
unsigned y[] = {
|
|
|
|
[4][NSNumber METH2]+2, // expected-warning {{use of GNU 'missing =' extension in designator}}
|
|
|
|
[4][x METH2]+2 // expected-warning {{use of GNU 'missing =' extension in designator}}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SomeStruct z = {
|
|
|
|
.x = [x METH2], // ok.
|
|
|
|
.x [x METH2] // expected-error {{expected '=' or another designator}}
|
|
|
|
};
|
|
|
|
}
|
2009-11-07 05:48:47 +08:00
|
|
|
|
|
|
|
// rdar://7370882
|
|
|
|
@interface SemicolonsAppDelegate
|
|
|
|
{
|
|
|
|
id i;
|
|
|
|
}
|
|
|
|
@property (assign) id window;
|
|
|
|
@end
|
|
|
|
|
|
|
|
@implementation SemicolonsAppDelegate
|
|
|
|
{
|
|
|
|
id i;
|
|
|
|
}
|
2009-11-07 06:15:27 +08:00
|
|
|
@synthesize window=i;
|
2009-11-07 05:48:47 +08:00
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
|
|
|