ALLOCATED() w/ user-defined ALLOCATABLE

ALLOCATED() w/ user-defined ALLOCATABLE

The following code returns an error when compiled:

--- module.f90 ---
MODULE MTest
TYPE CTest
INTEGER, ALLOCATABLE :: a(:)
END TYPE
END MODULE

--- main.f90 ---
PROGRAM MAIN
USE MTest
TYPE(CTest) :: t
IF (ALLOCATED(t%a)) STOP
END PROGRAM

The error returned is:
Error: The ARRAY argument of the ALLOCATED inquiry intrinsic function shall be an allocatable array. [ALLOCATED]

Interestingly, I can use the ALLOCATE() command successfully. Only the ALLOCATED() call fails.

If you declare the type within main.f90, it seems to work. It only fails with externally declared types.

Michael Carr

2 Beiträge / 0 neu
Letzter Beitrag
Nähere Informationen zur Compiler-Optimierung finden Sie in unserem Optimierungshinweis.

Send this example to vf-support@compaq.com Allocatable components of a derived type is a new feature and there are still some bugs.

Steve

Steve - Intel Developer Support

Kommentar hinterlassen

Bitte anmelden, um einen Kommentar hinzuzufügen. Sie sind noch nicht Mitglied? Jetzt teilnehmen