Debian Codegraph @

gcc/testsuite/gfortran.dg/allocate_class_4.f90

raw
1 ! { dg-do compile }
2 !
3 ! Part of PR 51946, but breaks easily, therefore introduce its own test
4 ! Authors: Damian Rouson <[email protected]>,
5 ! Dominique Pelletier <[email protected]>
6 ! Contributed by: Andre Vehreschild <[email protected]>
7
8 module integrable_model_module
9
10 implicit none
11
12 type, abstract, public :: integrable_model
13 contains
14 procedure(default_constructor), deferred :: empty_instance
15 end type
16
17 abstract interface
18 function default_constructor(this) result(blank_slate)
19 import :: integrable_model
20 class(integrable_model), intent(in) :: this
21 class(integrable_model), allocatable :: blank_slate
22 end function
23 end interface
24
25 contains
26
27 subroutine integrate(this)
28 class(integrable_model), intent(inout) :: this
29 class(integrable_model), allocatable :: residual
30 allocate(residual, source=this%empty_instance())
31 end subroutine
32
33 end module integrable_model_module