aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/derived_constructor_comps_2.f90
blob: a5e951ad1021f4d2da03ae531d9f68a5b8584c60 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
! { dg-do compile }
! Tests fix for PR29115, in which an ICE would be produced by 
! non-pointer elements being supplied to the pointer components
! in a derived type constructor.
!
! Contributed by Paul Thomas  <pault@gcc.gnu.org>
!
  type :: homer
    integer, pointer :: bart(:)
  end type homer
  type(homer) :: marge
  integer :: duff_beer
  marge = homer (duff_beer) ! { dg-error "should be a POINTER or a TARGET" }
end

!
! The following yield an ICE, see PR 34083
!
subroutine foo
  type ByteType
    character(len=1) :: singleByte
  end type
  type (ByteType) :: bytes(4)

  print *, size(bytes)
  bytes = ByteType((/'H', 'i', '!', ' '/)) ! { dg-error "rank of the element in the structure constructor" }
end subroutine foo