View previous topic :: View next topic |
Author |
Message |
jcherw
Joined: 27 Sep 2018 Posts: 57 Location: Australia
|
Posted: Fri Jun 11, 2021 5:28 am Post subject: Error re. definition of a derived type (in object) |
|
|
I have a subroutine that uses some Fortran 2003 extensions and FTN 95 gives an error on the following of these
type, public :: sparsematrix
integer :: nrow
integer :: ncol
integer :: nnz
type(rowtype),allocatable,dimension( :: row
NOTE THE PREVIEW OF THIS MESSAGE GIVES AN EMOJI AFTER THE DIMENSION IN THE STATEMENT ABOVE - IT SHOULD BE L_PARENTHESIS-COLON-R_PARETHESIS JUST AFTER DIMENSION
contains
procedure :: init => initialize
procedure :: addconnection
procedure :: filliaja
procedure :: sort
procedure :: destroy
end type sparsematrix
The error is
sparse.F(16) : error 515 - CONTAINS is invalid in the definition of a derived TYPE
There are also 2 warnings
sparse.F( : warning 1088 - The use of ALLOCATABLE in the definition of a derived TYPE is not standard conforming. No auto deallocation.
Could anyone suggest a workaround or resolution at least for the fatal error?
I am unfortunately unfamiliar with object-oriented programming, and this routine (part of a library) is the only of many where it is applied.
Thanks |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7925 Location: Salford, UK
|
Posted: Fri Jun 11, 2021 7:01 am Post subject: |
|
|
jcherw
CONTAINS within a TYPE definition is a feature of the Fortran 2003 Fortran standard that has not yet been implemented in FTN95. |
|
Back to top |
|
|
|