fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / where_operator_assign_4.f90
blobe1c479e5f938465c1ae42d1d8518c892d6936e50
1 ! { dg-do compile }
2 ! PR fortran/34661 ICE on user-defined assignments in where statements
3 ! Testcase contributed by Joost VandeVondele
5 MODULE M1
6 IMPLICIT NONE
7 TYPE T1
8 INTEGER :: I
9 END TYPE T1
10 INTERFACE ASSIGNMENT(=)
11 MODULE PROCEDURE S1
12 END INTERFACE
13 CONTAINS
14 SUBROUTINE S1(I,J)
15 TYPE(T1), INTENT(OUT) :: I(2)
16 TYPE(T1), INTENT(IN) :: J(2)
17 I%I=-J%I
18 END SUBROUTINE S1
19 END MODULE M1
21 USE M1
22 TYPE(T1) :: I(2),J(2)
23 I(:)%I=1
24 WHERE (I(:)%I>0)
25 J=I ! { dg-error "Non-ELEMENTAL user-defined assignment in WHERE" }
26 END WHERE
28 WHERE (I(:)%I>0) J=I ! { dg-error "Non-ELEMENTAL user-defined assignment in WHERE" }
30 END
31 ! { dg-final { cleanup-modules "m1" } }