The purpose of my code is to get an array of any type, and do type-specific things to different type. I am using pgfortran (Fortran 03 standard) to compile this and it compiles fine.
However the select type construct in my subroutine "test_class" won't work. It goes to class default
(which means it's neither integer nor real) every time while my array is actually integer.
What's wrong in my code? Do I need to use pointers?
subroutine test_class(array)
implicit none
class(*)::array(:)
select type (array)
type is (integer)
print*, 'type is integer'
type is (real)
print*, 'type is real'
class default
print*, 'no type found'
end select
end subroutine
program testpoly
implicit None
integer::test(3,3),i,j
do i = 1, 3
do j = 1, 3
test(i,j) = i+j
enddo
enddo
call test_class(test)
end program