Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Coarrays and defined assignment

$
0
0

I don't think that this is right!  It's not polymorphic ....

MODULE Assign

    IMPLICIT NONE

    INTEGER :: factor

    TYPE, PUBLIC :: Mytype

        INTEGER :: comp = 123

    CONTAINS

        PROCEDURE, PRIVATE :: Copy

        GENERIC :: ASSIGNMENT (=) => Copy

    END TYPE Mytype

CONTAINS

    PURE SUBROUTINE Copy (a, b)

        CLASS(Mytype), INTENT(OUT) :: a

        CLASS(Mytype), INTENT(IN) :: b

        a%comp = b%comp*factor

    END SUBROUTINE Copy

END MODULE Assign

PROGRAM Main

    USE Assign

    IMPLICIT NONE

    TYPE(Mytype) :: coarray[*]

    factor = THIS_IMAGE()

    SYNC ALL

    IF (THIS_IMAGE() == 1) THEN

        coarray = coarray[2]       ! (a)

        coarray[3] = coarray       ! (b)

        coarray[4] = coarray[5]    ! (c)

    END IF

END PROGRAM Main

ifort version 14.0.2

gerbil.f90(25): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]

        coarray = coarray[2]       ! (a)

------------------^

gerbil.f90(26): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]

        coarray[3] = coarray       ! (b)

--------^

gerbil.f90(27): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]

        coarray[4] = coarray[5]    ! (c)

--------^

gerbil.f90(27): error #8392: If the actual argument is a polymorphic coindexed object, the dummy argument must not be polymorphic.   [COARRAY]

        coarray[4] = coarray[5]    ! (c)

---------------------^

compilation aborted for gerbil.f90 (code 1)

 

 


Viewing all articles
Browse latest Browse all 2583

Trending Articles