summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/gomp/tpl-atomic-1.C
blob: ff1e3632db6db7bdc71d5313e6897db97e6047fa (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 }

int check;

template<typename T> void foo()
{
  #pragma omp atomic
  check |= sizeof(T);
}

template<typename T> void bar(T *x, T y)
{
  #pragma omp atomic
  *x += y;
}

void test ()
{
  int i;
  long l;

  foo<char>();
  foo<short>();
  bar(&i, 4);
  bar(&l, 8L);
}