fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / derived_recursion.f90
blobd0c0ea8d467ca529f3c79155ca9788d734b1345d
1 ! { dg-do compile }
2 ! { dg-options "-O0" }
3 ! Tests patch for PR24158 - The module would compile, in spite
4 ! of the recursion between the derived types. This would cause
5 ! an ICE in the commented out main program. The standard demands
6 ! that derived type components be already defined, to break
7 ! recursive derived type definitions.
9 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
11 module snafu
12 type :: a
13 integer :: v
14 type(b) :: i ! { dg-error "not been previously defined" }
15 end type a
16 type :: b
17 type(a) :: i
18 end type b
19 type (a) :: foo
20 end module snafu
22 ! use snafu
23 ! foo%v = 1
24 ! end
26 ! { dg-final { cleanup-modules "snafu" } }