http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57145
Bug #: 57145
Summary: [OOP] Faulty "Actual argument must be polymorphic"
error
Classification: Unclassified
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
The following program will not compile with the following error:
move_alloc.F90:16.20:
print*, my_func(static)
1
Error: Actual argument to 'input' at (1) must be polymorphic
However, if the declaration of type 'big' is removed altogether (comment lines
6-8), the program compiles without a problem.
######################################################
module my_module
type :: small
real :: a
end type
type :: big
class(small), pointer :: v(:)
end type
end module
program my_program
use my_module
implicit none
type(small) :: static(1)=[small(5.5)]
print*, my_func(static)
contains
function my_func(input)
class(small) :: input(:)
real :: my_func
my_func=input(1)%a
end function
end program