2009-03-24 10:24:46 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s -pedantic
|
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
|
|
|
}
|
|
|
|
|
2009-04-12 03:08:56 +08:00
|
|
|
void test2(NSNumber x) { // expected-error {{Objective-C interface type 'NSNumber' cannot be passed by value}}
|
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}}
|
|
|
|
};
|
|
|
|
}
|