Select type on pointer
Rouson, Damian
rouson@sandia.gov
Wed Nov 25 08:19:00 GMT 2009
The following code produces the error message below it. It appears gfortran
thinks 'total' is a function. I realize the "select type" statements are not
necessary but this evolved from an example in which this was an extended
type.
BTW, I get the same results with "class is" as with "type is." Thanks.
Damian
$ cat select_type.f03
module bar_module
implicit none
type :: bar
real ,dimension(:) ,allocatable :: f
contains
procedure :: total
end type
contains
function total(lhs,rhs)
class(bar) ,intent(in) :: lhs
class(bar) ,intent(in) :: rhs
class(bar) ,pointer :: total
select type(rhs)
type is (bar)
allocate(bar :: total)
select type(total)
type is (bar)
total%f = lhs%f + rhs%f
end select
end select
end function
$ gfortran -c select_type.f03
select_type.f03:18.25:
select type(total)
1
Error: Function 'total' requires an argument list at (1)
select_type.f03:20.17:
total%f = lhs%f + rhs%f
1
Error: 'total' at (1) is not a variable
select_type.f03:22.7:
end select
1
Error: Expecting END FUNCTION statement at (1)
More information about the Fortran
mailing list