summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/typebound_override_2.f90
blob: 98146b68141c41aec3d692178ddf6df3f4cd1a1e (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
! { dg-do compile }
!
! PR 47978: [OOP] Invalid INTENT in overriding TBP not detected
!
! Contributed by Salvatore Filippone <sfilippone@uniroma2.it>

module foo_mod
  type foo
  contains
    procedure, pass(f) :: bar => base_bar
  end type foo
contains 
  subroutine base_bar(f,j)
    class(foo), intent(inout) :: f
    integer, intent(in)    :: j
  end subroutine base_bar
end module foo_mod

module extfoo_mod
  use foo_mod
  type, extends(foo) :: extfoo
  contains
    procedure, pass(f) :: bar => ext_bar  ! { dg-error "INTENT mismatch in argument" }
  end type extfoo
contains 
  subroutine ext_bar(f,j)
    class(extfoo), intent(inout) :: f
    integer, intent(inout) :: j
  end subroutine ext_bar
end module extfoo_mod 

! { dg-final { cleanup-modules "foo_mod extfoo_mod" } }