| 1 |
! PR target/65504 |
| 2 |
! { dg-do run } |
| 3 |
|
| 4 |
program pr65504 |
| 5 |
implicit none |
| 6 |
type :: T |
| 7 |
character (len=256) :: a |
| 8 |
character (len=256) :: b |
| 9 |
end type T |
| 10 |
type (T) :: c |
| 11 |
type (T) :: d |
| 12 |
c = foo ("test") |
| 13 |
d = foo ("test") |
| 14 |
if (trim(c%b) .ne. "foo") STOP 1 |
| 15 |
contains |
| 16 |
type (T) function foo (x) result (v) |
| 17 |
character(len=*), intent(in) :: x |
| 18 |
select case (x) |
| 19 |
case ("test") |
| 20 |
v%b = 'foo' |
| 21 |
case ("bazx") |
| 22 |
v%b = 'barx' |
| 23 |
case default |
| 24 |
print *, "unknown" |
| 25 |
stop |
| 26 |
end select |
| 27 |
end function foo |
| 28 |
end program pr65504 |