PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gfortran.dg / class_dummy_3.f03
blob6b12eb892b084406c037376e4ad9f23bb73bd77a
1 ! { dg-do compile }
3 ! PR 46161: [OOP] Invalid: Passing non-polymorphic to allocatable polymorphic dummy
5 ! Contributed by Janus Weil <janus@gcc.gnu.org>
7   implicit none
9   type :: base
10   end type 
12   type, extends(base) :: ext
13   end type 
15   type(base), allocatable :: a
16   class(base), pointer :: b
17   class(ext), allocatable :: c
18   
19   call test(a)  ! { dg-error "must be polymorphic" }
20   call test(b)  ! { dg-error "must be ALLOCATABLE" }
21   call test(c)  ! { dg-error "must have the same declared type" }
23 contains
25   subroutine test(arg)
26     implicit none 
27     class(base), allocatable :: arg
28   end subroutine
30 end