view gcc/testsuite/g++.dg/gomp/pr89796.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents
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);
}