aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/c-c++-common/cilk-plus/CK/compound_cilk_spawn.c
blob: 5e687bd0a0c8cd6dc1aac1555c8722bee5a7fc8a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* { dg-do compile } */
/* { dg-options "-fcilkplus" } */

/* <feature>
   A program is considered ill formed if the _Cilk_spawn form of this
    expression appears other than in one of the following contexts:
    as the entire body of an expression statement,
    as the entire right hand side of an assignment expression that is the entire
    body of an expression statement, or as the entire initializer-clause in a 
    simple declaration.
   </feature>
*/

int spawn_func (int arg)
{
  return arg + 1;
}

int check()
{
  int z;
  z = 23, _Cilk_spawn spawn_func (3), 3424; /* { dg-error "spawned function call cannot be part of a comma expression" } */
  23, spawn_func (5), _Cilk_spawn spawn_func (3); /* { dg-error "spawned function call cannot be part of a comma expression" } */
  _Cilk_spawn spawn_func (0), _Cilk_spawn spawn_func (3), 3, spawn_func (0); /* { dg-error "spawned function call cannot be part of a comma expression" } */
  return 23;
}