Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/gfortran.dg/deferred_character_11.f90 @ 158:494b0b89df80 default tip
...
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 18:13:55 +0900 |
parents | 84e7813d76e9 |
children |
line wrap: on
line source
! { dg-do run } ! ! Test the fix for PR61147. ! ! Contributed by Thomas Clune <Thomas.L.Clune@nasa.gov> ! module B_mod type :: B character(:), allocatable :: string end type B contains function toPointer(this) result(ptr) character(:), pointer :: ptr class (B), intent(in), target :: this ptr => this%string end function toPointer end module B_mod program main use B_mod type (B) :: obj character(:), pointer :: p obj%string = 'foo' p => toPointer(obj) If (len (p) .ne. 3) STOP 1 If (p .ne. "foo") STOP 2 end program main