summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/pr33890.C
blob: 1710b928e343c53c12bf38d746a79b8d6c15bdc4 (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
27
28
29
30
31
32
33
34
// PR c++/33890
// { dg-do compile }
// { dg-options "-fopenmp" }

struct A
{
  int x;
  A () : x (0) {}
  int & getX ();
};

template <int> void
foo ()
{
  A a;

#pragma omp for
  for (int i = a.getX (); i < 10; ++i)
    ;
#pragma omp for
  for (int i = 0; i < a.getX (); ++i)
    ;
  a.x = 1;
#pragma omp for
  for (int i = 0; i < 10; i += a.getX ())
    ;
}

void
bar ()
{
  foo <0> ();
  foo <1> ();
}