blob: ab9bcabe954d192aeb2ea3ff630dfd47461d7b5c [file] [log] [blame]
/* APPLE LOCAL file radar 5732232 - blocks */
/* Test use of enumerators in blocks. */
/* { dg-do run } */
/* { dg-options "-fblocks" } */
#include <stdio.h>
void * _NSConcreteStackBlock;
void _Block_byref_assign_copy(void * dst, void *src){}
void _Block_byref_release(void*src){}
extern "C" void exit(int);
enum numbers
{
zero, one, two, three
};
typedef enum numbers (^myblock)(enum numbers);
enum numbers test(myblock I) {
return I(three);
}
int main() {
__byref enum numbers x = one;
__byref enum numbers y = two;
enum numbers res = test(^(enum numbers z){ y = z; return x; });
if (x != one || y != three || res != one)
exit(1);
res = test(^(enum numbers z){ x = z; return x; });
if (x != three || res != three)
exit(1);
return 0;
}