aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/select_type_25.f90
blob: 45fe9af7fce5763f89cfcb1f2181f444801526f9 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/51605
!

subroutine one()
type t
end type t
! (a) Invalid (was ICEing before)
class(t), target :: p1 ! { dg-error "must be dummy, allocatable or pointer" }
class(t), pointer :: p2

select type(p1)
  type is(t)
    p2 => p1
  class is(t)
    p2 => p1
end select
end subroutine one

subroutine two()
type t
end type t
class(t), allocatable, target :: p1 ! (b) Valid
class(t), pointer :: p2

select type(p1)
  type is(t)
    p2 => p1
  class is(t)
    p2 => p1
end select
end subroutine two

subroutine three()
type t
end type t
class(t), allocatable :: p1         ! (c) Invalid as not TARGET
class(t), pointer :: p2

select type(p1)
  type is(t)
    p2 => p1 ! { dg-error "Pointer assignment target is neither TARGET nor POINTER" }
  class is(t)
    p2 => p1 ! { dg-error "Pointer assignment target is neither TARGET nor POINTER" }
end select
end subroutine three

subroutine four()
type t
end type t
class(t), pointer :: p1             ! (d) Valid
class(t), pointer :: p2

select type(p1)
  type is(t)
    p2 => p1
  class is(t)
    p2 => p1
end select
end subroutine four

subroutine caf(x)
  type t
  end type t
  class(t) :: x[*]
  select type(x)
  type is(t)
  end select
end subroutine caf