summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/extends_type_of_2.f03
blob: b55eded96f963abfa6f7ff122b41517d37e06a35 (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
! { dg-do run }
!
! PR 47180: [OOP] EXTENDS_TYPE_OF returns the wrong result for disassociated polymorphic pointers 
!
! Contributed by Tobias Burnus <burnus@gcc.gnu.org>

implicit none

type t1
  integer :: a
end type t1

type, extends(t1):: t11
  integer :: b
end type t11

type(t1)  , target  :: a1
type(t11) , target  :: a11
class(t1) , pointer :: b1
class(t11), pointer :: b11

b1  => NULL()
b11 => NULL()

if (.not. extends_type_of(b1 , a1)) STOP 1
if (.not. extends_type_of(b11, a1)) STOP 2
if (.not. extends_type_of(b11,a11)) STOP 3

b1  => a1
b11 => a11

if (.not. extends_type_of(b1 , a1)) STOP 4
if (.not. extends_type_of(b11, a1)) STOP 5
if (.not. extends_type_of(b11,a11)) STOP 6

end