3 ! Test the fix of the test case referenced in comment 17 of PR83118.
5 ! Contributed by Damian Rouson <damian@sourceryinstitute.org>
9 class(*), allocatable :: elements(:)
18 class(*), allocatable :: obj
20 integer(4) :: expected4(2) = [42_4, 43_4]
21 integer(8) :: expected8(3) = [42_8, 43_8, 44_8]
23 w = new_wrapper (expected4)
26 obj = new_wrapper (expected8) ! Used to generate a linker error
28 obj = new_wrapper ([mytype (99.0)])
30 obj = Mytype (42.0) ! Used to generate a linker error
33 function new_wrapper(array) result (res)
36 res%elements = array ! Used to runtime segfault
38 subroutine test (arg, idx)
43 select type (z => arg%elements)
45 if (any (z .ne. [42_4, 43_4])) stop 1 + idx
47 if (any (z .ne. [42_8, 43_8, 44_8])) stop 1 + idx
49 if (abs (z(1)%r - 99.0) .ge. 1e-6) stop 1 + idx
54 if (abs (arg%r - 42.0) .ge. 1e-6) stop 1 + idx