View previous topic :: View next topic |
Author |
Message |
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Thu Dec 13, 2018 12:40 am Post subject: Derived type definition and private attribute |
|
|
Is this a bug? Should the private declaration in the header of the module def, prevent the main program from finding the definition of the type test_t?
Code: | module def
implicit none
private
type test_t
integer x
end type test_t
end module def
program main
use def
implicit none
type(test_t) :: a
a%x = 1
print *,a%x
end program main |
Or an explicit private applied to the type definition:-
Code: | module def
implicit none
private
type, private :: test_t
integer x
end type test_t
end module def
program main
use def
implicit none
type(test_t) :: a
a%x = 1
print *,a%x
end program main
|
In both of the above cases the private declaration(s) have no impact. FTN95 seems to differ from other compiliers on this one.
Ken |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7923 Location: Salford, UK
|
Posted: Thu Dec 13, 2018 12:15 pm Post subject: |
|
|
Ken
I think you are right and I have added code to fix this for the next version of FTN95 after 8.40. |
|
Back to top |
|
|
Kenneth_Smith
Joined: 18 May 2012 Posts: 697 Location: Hamilton, Lanarkshire, Scotland.
|
Posted: Sat Dec 15, 2018 1:09 pm Post subject: |
|
|
Thanks Paul,
Another one for you to consider. This compiles with no errors, which I think is wrong since mod_b should have no access to the definition of z_t.
Code: | module a_mod
implicit none
type xy_t
integer x, y
end type xy_t
type z_t
integer z
end type z_t
end module a_mod
module b_mod
use a_mod, only : xy_t
implicit none
type(z_t) something(1:10) !FTN95 ignores the only directive
end module b_mod |
|
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7923 Location: Salford, UK
|
Posted: Sat Dec 15, 2018 3:03 pm Post subject: |
|
|
Thanks Ken. I have logged this for investigation. |
|
Back to top |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7923 Location: Salford, UK
|
Posted: Mon Dec 31, 2018 8:43 am Post subject: |
|
|
This one has now been fixed for the next release of FTN95. |
|
Back to top |
|
|
|