gcc/fortran/:
[official-gcc.git] / gcc / testsuite / gfortran.dg / derived_constructor_comps_2.f90
blobef3005da294ccaf6f9ade49440d1d63e3dc84aaf
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.
6 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
8 type :: homer
9 integer, pointer :: bart(:)
10 end type homer
11 type(homer) :: marge
12 integer :: duff_beer
13 marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" }
14 end
17 ! The following yield an ICE, see PR 34083
19 subroutine foo
20 type ByteType
21 character(len=1) :: singleByte
22 end type
23 type (ByteType) :: bytes(4)
25 print *, size(bytes)
26 bytes = ByteType((/'H', 'i', '!', ' '/)) ! { dg-error "rank of the element in the derived type constructor" }
27 end subroutine foo