gcc/testsuite/gfortran.dg/realloc_on_assign_27.f08
raw| 1 | ! { dg-do run } |
| 2 | |
| 3 | type :: t |
| 4 | integer :: i |
| 5 | end type |
| 6 | |
| 7 | type, extends(t) :: r |
| 8 | real :: r |
| 9 | end type |
| 10 | |
| 11 | class(t), allocatable :: x |
| 12 | type(r) :: y = r (3, 42) |
| 13 | |
| 14 | x = y |
| 15 | if (x%i /= 3) STOP 1 |
| 16 | select type(x) |
| 17 | class is (r) |
| 18 | if (x%r /= 42.0) STOP 2 |
| 19 | class default |
| 20 | STOP 3 |
| 21 | end select |
| 22 | end |
| 23 |