1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2! OpenMP Version 5.1
3! Check OpenMP construct validity for the following directives:
4! 2.21.2 Threadprivate Directive
5
6module thread_private01
7  use omp_lib
8  type my_type(kind_param, len_param)
9    integer, KIND :: kind_param
10    integer, LEN :: len_param
11    integer :: t_i
12    integer :: t_arr(10)
13  end type my_type
14
15  type(my_type(2, 4)) :: my_var
16  integer :: arr(10)
17  integer(kind=4) :: x
18  character(len=32) :: w
19  integer, dimension(:), allocatable :: y
20
21  !$omp threadprivate(my_var)
22
23  !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
24  !$omp threadprivate(my_var%t_i)
25
26  !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
27  !$omp threadprivate(my_var%t_arr)
28
29  !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
30  !$omp threadprivate(my_var%kind_param)
31
32  !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
33  !$omp threadprivate(my_var%len_param)
34
35  !$omp threadprivate(arr)
36
37  !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
38  !$omp threadprivate(arr(1))
39
40  !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
41  !$omp threadprivate(arr(1:2))
42
43  !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
44  !$omp threadprivate(x%KIND)
45
46  !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
47  !$omp threadprivate(w%LEN)
48
49  !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
50  !$omp threadprivate(y%KIND)
51end
52