view gcc/testsuite/g++.dg/gomp/pr89796.C @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 1830386684a0
children
line wrap: on
line source

// PR c++/89796
// { dg-do compile }
// { dg-additional-options "-Wunused-value" }

int
f1 (int &c)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = c; c++; }
  return r;
}

template <int N>
int
f2 (int &c)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = c; c++; }
  return r;
}

int
f3 (int &c)
{
  return f2 <0> (c);
}

int
f4 (int *p)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = *p; (*p)++; }
  return r;
}

template <int N>
int
f5 (int *p)
{
  int r;
  #pragma omp atomic capture	// { dg-bogus "value computed is not used" }
  { r = *p; (*p)++; }
  return r;
}

int
f6 (int *p)
{
  return f5 <0> (p);
}