1  void
       2  foo (void)
       3  {
       4    int i;
       5  
       6    #pragma omp parallel
       7    {
       8      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
       9      ;
      10    }
      11    #pragma omp teams
      12    {
      13      #pragma omp teams	/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      14      ;
      15    }
      16    #pragma omp target
      17    {
      18      #pragma omp parallel
      19      {
      20        #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      21        ;
      22      }
      23    }
      24    #pragma omp for
      25    for (i = 0; i < 4; i++)
      26      if (i == 0)
      27        {
      28  	#pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      29  	;
      30        }
      31    #pragma omp single
      32    #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      33    ;
      34    #pragma omp master
      35    {
      36      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      37      ;
      38    }
      39    #pragma omp critical
      40    #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      41    ;
      42    #pragma omp sections
      43    {
      44      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      45      ;
      46      #pragma omp section
      47      {
      48        #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      49        ;
      50      }
      51    }
      52    #pragma omp target data map (to: i)
      53    {
      54      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      55      ;
      56    }
      57    #pragma omp task
      58    {
      59      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      60      ;
      61    }
      62    #pragma omp taskgroup
      63    {
      64      #pragma omp teams	/* { dg-error "'teams' construct must be closely nested inside of 'target' construct or not nested in any OpenMP construct" } */
      65      ;
      66    }
      67  }
      68  
      69  void
      70  bar (void)
      71  {
      72    #pragma omp teams
      73    {
      74      int x, y, v = 4;
      75      #pragma omp target			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      76      ;
      77      #pragma omp target data map (to: v)	/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      78      ;
      79      #pragma omp for			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      80      for (int i = 0; i < 64; ++i)
      81        ;
      82      #pragma omp simd			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      83      for (int i = 0; i < 64; ++i)
      84        ;
      85      #pragma omp for simd		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      86      for (int i = 0; i < 64; ++i)
      87        ;
      88      #pragma omp single			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      89      ;
      90      #pragma omp master			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      91      ;
      92      #pragma omp sections		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      93      {
      94        x = 1;
      95        #pragma omp section
      96        y = 2;
      97      }
      98      #pragma omp critical		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
      99      ;
     100      #pragma omp target enter data map (to: v)	/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     101      #pragma omp target exit data map (from: v)	/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     102      #pragma omp cancel parallel		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     103      #pragma omp cancellation point parallel /* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     104      #pragma omp barrier			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     105      #pragma omp ordered			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     106      ;
     107      #pragma omp task			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     108      ;
     109      #pragma omp taskloop		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     110      for (int i = 0; i < 64; ++i)
     111        ;
     112      #pragma omp atomic			/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     113      v++;
     114      #pragma omp taskgroup		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     115      ;
     116      #pragma omp taskwait		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     117      #pragma omp taskyield		/* { dg-error "only 'distribute', 'parallel' or 'loop' regions are allowed to be strictly nested inside 'teams' region" } */
     118    }
     119  }