blob: d93997ad6835e3d556692bd2ffb3fbf97e4a1014 [file] [log] [blame]
Fariborz Jahanianb372b0f2010-02-18 20:31:02 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -fblocks
2
3extern "C" int exit(int);
4
5typedef struct {
6 unsigned long ps[30];
7 int qs[30];
8} BobTheStruct;
9
10int main (int argc, const char * argv[]) {
11 BobTheStruct inny;
12 BobTheStruct outty;
13 BobTheStruct (^copyStruct)(BobTheStruct);
14 int i;
15
16 for(i=0; i<30; i++) {
17 inny.ps[i] = i * i * i;
18 inny.qs[i] = -i * i * i;
19 }
20
21 copyStruct = ^(BobTheStruct aBigStruct){ return aBigStruct; }; // pass-by-value intrinsically copies the argument
22
23 outty = copyStruct(inny);
24
25 if ( &inny == &outty ) {
26 exit(1);
27 }
28 for(i=0; i<30; i++) {
29 if ( (inny.ps[i] != outty.ps[i]) || (inny.qs[i] != outty.qs[i]) ) {
30 exit(1);
31 }
32 }
33
34 return 0;
35}