2 ! { dg-require-effective-target lto }
3 ! { dg-options "-flto" }
5 ! Checks that the results of module procedures have the correct characteristics
6 ! and that submodules use the module version of vtables (PR66762). This latter
7 ! requires the -flto compile option.
9 ! Contributed by Reinhold Bader <reinhold.bader@lrz.de>
16 module subroutine p_a(this, q)
17 class(t_a), intent(inout) :: this
18 class(*), intent(in) :: q
20 module function create_a() result(r)
21 class(t_a), allocatable :: r
23 module subroutine print(this)
24 class(t_a), intent(in) :: this
32 integer, allocatable :: I(:)
35 module function create_b(i) result(r)
42 submodule(mod_b) imp_create
44 module procedure create_b
45 if (allocated(r%i)) deallocate(r%i)
46 allocate(r%i, source=i)
48 end submodule imp_create
50 submodule(mod_a) imp_p_a
52 type, extends(t_a) :: t_imp
55 integer, parameter :: ii(2) = [1,2]
57 module procedure create_a
60 allocate(r, source=t_imp(b))
76 module procedure print
79 if (any (this%b%i .ne. [3,4,5])) STOP 3
90 class(t_a), allocatable :: a
91 allocate(a, source=create_a())
92 call p_a(a, create_b([3,4,5]))