32 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! C911 - abstract derived type can be used only when polymorphic3program test4 type, abstract :: abstract5 integer :: j6 end type7 type, extends(abstract) :: concrete8 integer :: k9 class(concrete), allocatable :: a(:)10 end type11 type(concrete) :: x(2)12 call sub1(x(1)) ! ok13 call sub2(x) ! ok14 call sub1(x(1)%a(1)) ! ok15 call sub2(x(1)%a) ! ok16 !ERROR: Reference to object with abstract derived type 'abstract' must be polymorphic17 call sub1(x(1)%abstract) ! bad18 !ERROR: Reference to object with abstract derived type 'abstract' must be polymorphic19 call sub2(x%abstract) ! bad20 !ERROR: Reference to object with abstract derived type 'abstract' must be polymorphic21 call sub1(x(1)%a(1)%abstract) ! bad22 !ERROR: Reference to object with abstract derived type 'abstract' must be polymorphic23 call sub2(x(1)%a%abstract) ! bad24 contains25 subroutine sub1(d)26 class(abstract) d27 end subroutine28 subroutine sub2(d)29 class(abstract) d(:)30 end subroutine31end32