Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

More submodule head scratching.... functions with result() array

$
0
0

Consider:

    ! the interface part in the module which compiles OK

    module function double_it(A)
       REAL(KIND=IRK), intent(in) :: A(3)
       REAL(KIND=IRK)             :: double_it(3)
    end function double_it

    ! the implementation part in the submodule.
    ! error #6833: The RESULT data type is  multiply specified: on function statement and result name.   [B]
    ! error #6834: Array specifications must be given for result name, not function.   [B]
    ! both errors relate to the line below
    module function double_it(A) result(B)
       implicit none
       REAL(KIND=IRK), intent(in) :: A(3)
       REAL(KIND=IRK)             :: B(3)
       B=2._IRK*A
    end function double_it

Can one use result with module function? If so what is the correct syntax I have spend some time trying to find enlightenment and have failed again :-(

.


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>