view gcc/testsuite/g++.dg/gomp/pr81154.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

// PR c++/81154
// { dg-do compile }

template <typename T>
struct C
{
  int foo (T n) const
  {
#pragma omp parallel shared (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel private (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel firstprivate (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel for lastprivate (foo)	// { dg-error "is not a variable in clause" }
    for (T i = 0; i < n; i++)
      ;
#pragma omp parallel for linear (foo)	// { dg-error "is not a variable in clause" }
    for (T i = 0; i < n; i++)
      ;
#pragma omp parallel reduction (+:foo)	// { dg-error "is not a variable in clause" }
    ;
    return 0;
  }
  int foo (int x, int y) { return x; }
};

struct D
{
  typedef int T;
  int foo (T n) const
  {
#pragma omp parallel shared (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel private (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel firstprivate (foo)	// { dg-error "is not a variable in clause" }
    ;
#pragma omp parallel for lastprivate (foo)	// { dg-error "is not a variable in clause" }
    for (T i = 0; i < n; i++)
      ;
#pragma omp parallel for linear (foo)	// { dg-error "is not a variable in clause" }
    for (T i = 0; i < n; i++)
      ;
#pragma omp parallel reduction (+:foo)	// { dg-error "is not a variable in clause" }
    ;
    return 0;
  }
  int foo (int x, int y) { return x; }
};

int
main ()
{
  C<int> ().foo (1);
  D ().foo (1);
}