Fix spawned function with lambda function
[platform/upstream/gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / CK / pr60586.c
1 /* { dg-do run  { target { i?86-*-* x86_64-*-* } } } */
2 /* { dg-options "-fcilkplus -O2" } */
3 /* { dg-additional-options "-lcilkrts" { target { i?86-*-* x86_64-*-* } } } */
4
5 int noop(int x)
6 {
7   return x;
8 }
9
10 int post_increment(int *x)
11 {
12   return (*x)++;
13 }
14
15 int main(int argc, char *argv[])
16 {
17   int m = 5;
18   int n = m;
19   int r = _Cilk_spawn noop(post_increment(&n));
20   int n2 = n;
21   _Cilk_sync;
22
23   if (r != m || n2 != m + 1)
24     return 1;
25   else
26     return 0;
27 }
28