summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/typebound_proc_24.f03
blob: f200e0efbbc37ff093808516a2fe1949ec8b1b6a (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 49112: [4.6/4.7 Regression] [OOP] Missing type-bound procedure, "duplicate save" warnings and internal compiler error
!
! Contributed by John <jwmwalrus@gmail.com>

module datetime_mod

  implicit none

  type :: DateTime
    integer :: year, month, day
  contains
    procedure :: getFormattedString
  end type

  type(DateTime) :: ISO_REFERENCE_DATE = DateTime(1875, 5, 20)

contains

  character function getFormattedString(dt)
    class(DateTime) :: dt
  end function

  subroutine test
    type(DateTime) :: dt
    print *,dt%getFormattedString()
  end subroutine

end module 

! { dg-final { cleanup-modules "datetime_mod" } }