This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Are type-bound procedures and classes supported yet by gfortran?


Hi all,

Thank you for your work on gfortran!  I was wondering if type-bound
procedures and classes supported yet?

This is a subset of the module I'm writting that still shows the
errors I've included below.  I've been trying to find my errors for
some time.  Is it simply something that has just gone into my
programming 'blind spot' or are the features not yet supported?  If
they aren't supported are there suggestions as to what I should use to
support them?

thank you!
Richard

module planet_class
   implicit none
   integer, parameter :: dbl = selected_real_kind(p=15, r=200)

   type, public :: planet
      private
      integer :: planetID = -1
      real(kind=dbl) :: gravitySurf, densitySurf, scaleHeight, radiusPlanet
   contains
      procedure, pass :: rho=>getDensity
      procedure, pass :: p=>getPressure
   end type planet

   contains

      real function getDensity(this, altitude)
         implicit none
         class(planet), intent(in) :: this
         real(kind=dbl), intent(in) :: altitude
         getDensity = altitude+1 ! temp equation
      end function getDensity

      real function getPressure(this, altitude)
         implicit none
         class(planet) :: this
         real(kind=dbl), intent(in) :: altitude
         getPressure = altitude+1 ! temp equation
      end function getPressure

end module planet_class

=================================

This code generates the following errors:

richard@panther:~/testCode/pesst$ gfortran -o run test.f90
test.f90:10.10:

  contains
         1
Error: Unexpected CONTAINS statement at (1)
test.f90:11.4:

    procedure, pass :: rho=>getDensity
   1
Error: Unclassifiable statement at (1)
test.f90:12.4:

    procedure, pass :: p=>getPressure
   1
Error: Unclassifiable statement at (1)
test.f90:19.6:

      class(planet), intent(in) :: this
     1
Error: Unclassifiable statement at (1)
test.f90:26.6:

      class(planet) :: this
     1
Error: Unclassifiable statement at (1)
test.f90:24.34:

    real function getPressure(this, altitude)
                                 1
Error: Symbol 'this' at (1) has no IMPLICIT type
test.f90:17.33:

    real function getDensity(this, altitude)
                                1
Error: Symbol 'this' at (1) has no IMPLICIT type


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]