view gcc/testsuite/gfortran.dg/realloc_on_assign_27.f08 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
line wrap: on
line source

! { dg-do run }

  type :: t
    integer :: i
  end type

  type, extends(t) :: r
    real :: r
  end type

  class(t), allocatable :: x
  type(r) :: y = r (3, 42)

  x = y
  if (x%i /= 3) call abort()
  select type(x)
    class is (r)
      if (x%r /= 42.0) call abort()
    class default
      call abort()
  end select
end