2 // The LLVM Compiler Infrastructure
4 // This file is distributed under the University of Illinois Open Source
5 // License. See LICENSE.TXT for details.
7 // -*- mode:C; c-basic-offset:4; tab-width:4; intent-tabs-mode:nil; -*-
19 int main (int argc
, const char * argv
[]) {
22 BobTheStruct (^copyStruct
)(BobTheStruct
);
25 memset(&inny
, 0xA5, sizeof(inny
));
26 memset(&outty
, 0x2A, sizeof(outty
));
29 inny
.ps
[i
] = i
* i
* i
;
30 inny
.qs
[i
] = -i
* i
* i
;
33 copyStruct
= ^(BobTheStruct aBigStruct
){ return aBigStruct
; }; // pass-by-value intrinsically copies the argument
35 outty
= copyStruct(inny
);
37 if ( &inny
== &outty
) {
38 printf("%s: struct wasn't copied.", argv
[0]);
42 if ( (inny
.ps
[i
] != outty
.ps
[i
]) || (inny
.qs
[i
] != outty
.qs
[i
]) ) {
43 printf("%s: struct contents did not match.", argv
[0]);
48 printf("%s: success\n", argv
[0]);