- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I see that for the program below, 2018 update 1 gives a compile time error. (compilers until 2017 update 4 didn't do so. Haven't tested it with update 5 and 6.) Just checking if it indeed "as per standard".
Abhijit
----
Program Test
Implicit None
Type newOBJ
Integer :: I
End Type newOBJ
Type(newOBJ) :: OBJ
Associate(This => OBJ, I => This%I) ! Use of "This" is not allowed? Is that correct?
I = 1
End Associate
! The lines below would be what is needed
!Associate(This => OBJ)
! Associate(I => This%I) ! Breaking it into two separate associates is allowed; other option would be to use OBJ%I
! I = 1
! End Associate
!End Associate
End Program Test
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, this is intended, per naming scoping rules.
The associate-name has the scope of the block of the ASSOCIATE construct, and so doesn't become "live" until inside the ASSOCIATE itself.
Your nested ASSOCIATE would be the correct solution ( or, to use OBJ%I, as you stated, too )
--Lorri
PS: You won't see this message in a 17.x compiler; the fix only went into 18.0 and later.

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