| 1 |
! { dg-do compile } |
| 2 |
! Tests fix for PR29115, in which an ICE would be produced by |
| 3 |
! non-pointer elements being supplied to the pointer components |
| 4 |
! in a derived type constructor. |
| 5 |
! |
| 6 |
! Contributed by Paul Thomas <[email protected]> |
| 7 |
! |
| 8 |
type :: homer |
| 9 |
integer, pointer :: bart(:) |
| 10 |
end type homer |
| 11 |
type(homer) :: marge |
| 12 |
integer :: duff_beer(1) |
| 13 |
marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" } |
| 14 |
end |
| 15 |
|
| 16 |
! |
| 17 |
! The following yield an ICE, see PR 34083 |
| 18 |
! |
| 19 |
subroutine foo |
| 20 |
type ByteType |
| 21 |
character(len=1) :: singleByte |
| 22 |
end type |
| 23 |
type (ByteType) :: bytes(4) |
| 24 |
|
| 25 |
print *, size(bytes) |
| 26 |
bytes = ByteType((/'H', 'i', '!', ' '/)) ! { dg-error "rank of the element in the structure constructor" } |
| 27 |
end subroutine foo |