- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
--- 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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page