This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Select type on pointer
- From: "Rouson, Damian" <rouson at sandia dot gov>
- To: gfortran <fortran at gcc dot gnu dot org>
- Date: Tue, 24 Nov 2009 03:48:19 -0700
- Subject: Select type on pointer
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)