Skip to content

Commit d94582e

Browse files
authored
[flang][OpenMP] Add test for checking overloaded operator in atomic update (#88471)
Atomic update expression does not allow overloaded user-defined operators. This PR adds a test case for the same; the semantic check is already existent.
1 parent 74a8754 commit d94582e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2+
3+
module new_operator
4+
implicit none
5+
6+
interface operator(.MYOPERATOR.)
7+
module procedure myprocedure
8+
end interface
9+
contains
10+
pure integer function myprocedure(param1, param2)
11+
integer, intent(in) :: param1, param2
12+
myprocedure = param1 + param2
13+
end function
14+
end module
15+
16+
program sample
17+
use new_operator
18+
implicit none
19+
integer :: x, y
20+
21+
!$omp atomic update
22+
x = x / y
23+
24+
!$omp atomic update
25+
!ERROR: Invalid or missing operator in atomic update statement
26+
x = x .MYOPERATOR. y
27+
28+
!$omp atomic
29+
!ERROR: Invalid or missing operator in atomic update statement
30+
x = x .MYOPERATOR. y
31+
end program

0 commit comments

Comments
 (0)