Debian Codegraph @

gcc/testsuite/gfortran.dg/impure_constructor_1.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/43362
4 !
5 module m
6 implicit none
7 type t
8 integer, pointer :: a
9 end type t
10 type t2
11 type(t) :: b
12 end type t2
13 type t3
14 type(t), pointer :: b
15 end type t3
16 contains
17 pure subroutine foo(x)
18 type(t), target, intent(in) :: x
19 type(t2) :: y
20 type(t3) :: z
21
22 ! The following gave an ICE but is valid:
23 y = t2(x) ! Note: F2003, C1272 (3) and (4) do not apply
24
25 ! Variant which is invalid as C1272 (3) applies
26 z = t3(x) ! { dg-error "Invalid expression in the structure constructor" }
27 end subroutine foo
28 end module m