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 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

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

发表评论

登录添加评论。还不是成员?立即加入