[to-be-committed] [RISC-V] Use Zbkb for general 64 bit constants when profitable
[official-gcc.git] / gcc / testsuite / gfortran.dg / abstract_type_9.f90
blob77d48ba61f5a73440225f3c1cf420aa9d0abdcdf
1 ! { dg-do compile }
3 ! PR 43207: [OOP] invalid (pointer) assignment to and from abstract non-polymorphic expressions
5 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
7 implicit none
8 type, abstract :: parent
9 integer :: i
10 end type
11 type, extends(parent) :: child
12 class(parent), pointer :: comp
13 end type
15 type(child), target :: c1
16 class(child), allocatable :: c2
17 class(parent), pointer :: cp
19 c1%parent = c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" }
20 c2%parent = c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" }
22 cp => c1%comp
23 cp => c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" }
25 call sub(c1%comp)
26 call sub(c1%parent) ! { dg-error "Nonpolymorphic reference to abstract type" }
28 contains
30 subroutine sub(arg)
31 class(parent) :: arg
32 end subroutine
34 end