Software Archive
Read-only legacy content
17061 Discussions

ALLOCATED() w/ user-defined ALLOCATABLE

michael-a-carr
Beginner
332 Views
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
0 Kudos
1 Reply
Steven_L_Intel1
Employee
332 Views
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
0 Kudos
Reply