1! { dg-do compile } 2! 3! PR 43207: [OOP] invalid (pointer) assignment to and from abstract non-polymorphic expressions 4! 5! Contributed by Tobias Burnus <burnus@gcc.gnu.org> 6 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 14 15 type(child), target :: c1 16 class(child), allocatable :: c2 17 class(parent), pointer :: cp 18 19 c1%parent = c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" } 20 c2%parent = c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" } 21 22 cp => c1%comp 23 cp => c1%parent ! { dg-error "Nonpolymorphic reference to abstract type" } 24 25 call sub(c1%comp) 26 call sub(c1%parent) ! { dg-error "Nonpolymorphic reference to abstract type" } 27 28contains 29 30 subroutine sub(arg) 31 class(parent) :: arg 32 end subroutine 33 34end 35