2 ! { dg-options "-std=f2008" }
3 ! Test of an issue found in the investigation of PR112407. The dg-option is
4 ! set to avoid regression once the F2018 RECURSIVE by default in implemented.
5 ! Contributed by Tomas Trnka <trnka@scm.com>
11 procedure(),pointer,nopass
:: op
21 generic
:: new
=> new_t
, bar
22 generic
, public
:: assignment(=) => add_t
26 integer :: i
= 0, finals
= 0
29 subroutine new_t (arg1
, arg2
) ! gfortran didn't detect the recursion
30 class(t
), intent(out
) :: arg1
31 type(t
), intent(in
) :: arg2
34 print *, "new_t", arg1
%i
, arg2
%i
37 if (arg1
%i
.ne
. arg2
%i
) then
39 call arg1
%new(arg2
) ! { dg-warning "possibly calling itself recursively" }
44 class(t
), intent(out
) :: arg
45 call arg
%new(t(42, s(new_t
)))
48 subroutine add_t (arg1
, arg2
)
49 class(t
), intent(out
) :: arg1
50 type(t
), intent(in
) :: arg2
54 impure elemental
subroutine final_t (arg1
)
55 type(t
), intent(in
) :: arg1