| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Test the fix for PR104555 in which the select type statement caused an |
| 4 |
! ICE because the selector expression was type(t) rather than class(t). |
| 5 |
! |
| 6 |
! Contributed by Gerhard Steinmetz <[email protected]> |
| 7 |
! |
| 8 |
program p |
| 9 |
type t |
| 10 |
character(:), allocatable :: a |
| 11 |
end type |
| 12 |
call s(t("abcd")) |
| 13 |
call s([t("efgh")]) |
| 14 |
contains |
| 15 |
subroutine s(x) |
| 16 |
class(t) :: x(..) |
| 17 |
select rank (x) |
| 18 |
rank (0) |
| 19 |
print *, "|", x%a, "|" |
| 20 |
select type (y => x) |
| 21 |
type is (t) |
| 22 |
print *, "|", y%a, "|" |
| 23 |
end select |
| 24 |
rank (1) |
| 25 |
print *, "|", x(1)%a, "|" |
| 26 |
select type (y => x) |
| 27 |
type is (t) |
| 28 |
print *, "|", y(1)%a, "|" |
| 29 |
end select |
| 30 |
end select |
| 31 |
end |
| 32 |
end |