- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a module that includes some abstract interfaces. These interfaces use derived types from different modules, and I import these in the abstract interface by an "import" statement of the derived type in question, with the module the derived type is contained in being "use"d in the module itself. This compiles fine on gfortran, but with Intel Fortran 18, I get a "This derived type name has not been declared" error, and I can't figure out why. The module in question is below, and the derived type that throws the error is the "Result" derived type from the "ResultModule" module:
module spcEstuaryReach
use ResultModule
implicit none
type, public, abstract :: EstuaryReach
contains
procedure(createEstuaryReach), deferred :: create
procedure(updateEstuaryReach), deferred :: update
end type
abstract interface
function createEstuaryReach(me) result(r)
import EstuaryReach, Result
class(EstuaryReach) :: me
type(Result) :: r
end function
function updateEstuaryReach(me, t) result(r)
import EstuaryReach, Result
class(EstuaryReach) :: me
integer :: t
type(Result) :: r
end function
end interface
end module
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Sam Harrison,
Providing a couple of details will greatly increase the likelihood of useful responses: 1) Intel Fortran compiler version and 2) a complete reproducer.
You can try something like this:
module a
! file a.f90
type :: x
end type
end module
module b
! file b.f90
use a, only : x
type, abstract :: y
contains
procedure(Ifun), pass(this), deferred :: fun
end type
abstract interface
function Ifun( this ) result(r)
import :: x, y
implicit none
class(y), intent(in) :: this
type(x) :: r
end function
end interface
end module
C:\temp>ifort /c /standard-semantics /warn:all /stand a.f90 Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R ) 64, Version 18.0.1.156 Build 20171018 Copyright (C) 1985-2017 Intel Corporation. All rights reserved. C:\temp>ifort /c /standard-semantics /warn:all /stand b.f90 Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R ) 64, Version 18.0.1.156 Build 20171018 Copyright (C) 1985-2017 Intel Corporation. All rights reserved. C:\temp>
Note this particular example works with Intel Fortran compiler 17.0 update 5 as well as 18.0 update 1, so you will need to cross-check the code and with your compiler version.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page