- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The snippet below will not give a compile time error. But I am thinking it should since the variable "first" is not accessible through module Two. The error is caught if Use One is written after Use Two in the program.
Abhi
------
Module One
Implicit None
Private
Integer :: first = 1
Public :: first
End Module One
Module Two
Use One
Implicit None
Private
Integer :: second = 2, third = 3
Public :: second
End Module Two
Program Test_Private
Use One ! This won't give an error.
Use Two, only: first, second
!Use One ! Comment the previous and Uncomment this will give an error.
Implicit None
Print *, first
Print *, second
End Program Test_Private
Abhi
------
Module One
Implicit None
Private
Integer :: first = 1
Public :: first
End Module One
Module Two
Use One
Implicit None
Private
Integer :: second = 2, third = 3
Public :: second
End Module Two
Program Test_Private
Use One ! This won't give an error.
Use Two, only: first, second
!Use One ! Comment the previous and Uncomment this will give an error.
Implicit None
Print *, first
Print *, second
End Program Test_Private
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that this seems to be a bug. I'll report it - thanks. Issue ID is DPD200139378.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I agree that this seems to be a bug. I'll report it - thanks. Issue ID is DPD200139378.
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