1! { dg-do compile }
2! { dg-options "-fopenmp" }
3
4program task_detach_1
5  use iso_c_binding, only: c_intptr_t
6  implicit none
7
8  integer, parameter :: omp_event_handle_kind = c_intptr_t
9  integer (kind=omp_event_handle_kind) :: x, y
10  integer(1) :: z
11
12  !$omp task detach(x) detach(y) ! { dg-error "Failed to match clause at \\\(1\\\)" }
13  !$omp end task ! { dg-error "Unexpected !\\\$OMP END TASK statement at \\\(1\\\)" }
14
15  !$omp task mergeable detach(x) ! { dg-error "'DETACH' clause at \\\(1\\\) must not be used together with 'MERGEABLE' clause" }
16  !$omp end task
17
18  !$omp task detach(x) mergeable ! { dg-error "'DETACH' clause at \\\(1\\\) must not be used together with 'MERGEABLE' clause" }
19  !$omp end task
20
21  !$omp task detach(z) ! { dg-error "'z' at \\\(1\\\) should be of type integer\\\(kind=omp_event_handle_kind\\\)" }
22  !$omp end task ! { dg-error "Unexpected !\\\$OMP END TASK statement at \\\(1\\\)" }
23
24  !$omp task detach (x) firstprivate (x) ! { dg-error "DETACH event handle 'x' in FIRSTPRIVATE clause at \\\(1\\\)" }
25  !$omp end task
26
27  !$omp task detach (x) shared (x) ! { dg-error "DETACH event handle 'x' in SHARED clause at \\\(1\\\)" }
28  !$omp end task
29end program
30