2 ! { dg-options "-Wreturn-type" }
4 ! Check that pr58586 is fixed now.
5 ! Based on a contribution by Vladimir Fuka
6 ! Contibuted by Andre Vehreschild
8 module test_pr58586_mod
15 type(a), allocatable :: a
20 procedure :: init => d_init
25 procedure :: init => e_init
29 integer, allocatable :: a
46 subroutine add_class_c (d)
54 type(c) function c_init() ! { dg-warning "not set" }
57 class(c) function c_init2() ! { dg-warning "not set" }
58 allocatable :: c_init2
61 type(c) function d_init(this) ! { dg-warning "not set" }
65 type(c) function e_init(this)
70 type(t) function t_init() ! { dg-warning "not set" }
74 type(t) function static_t_init() ! { dg-warning "not set" }
76 end module test_pr58586_mod
81 class(d), allocatable :: od
82 class(e), allocatable :: oe
83 type(t), allocatable :: temp
85 ! These two are merely to check, if compilation works
89 ! This needs to execute, to see whether the segfault at runtime is resolved
91 call add_class_c(c_init2())
93 call add_t(static_t_init())
94 ! temp = t_init() ! <-- This derefs a null-pointer currently
96 if (allocated (temp)) call abort()
102 call add_c(oe%init())