[Bug fortran/33106] Access of components of public entities of private types wrongly allowed
burnus at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Aug 19 17:50:00 GMT 2007
------- Comment #3 from burnus at gcc dot gnu dot org 2007-08-19 17:50 -------
> does any other standard but F95 allow the usage of private derived type
> outside their defining module? I'd think that an error is called for,
> regardless of the version of the standard?!
Believing NAG the following is allowed in Fortran 2003 but not in Fortran 95:
module m
type, private :: hidden_type; character(6) :: code; end type
type(hidden_type), public, parameter :: code_green = hidden_type('green')
end module
use m, only: code_green, module_procedure_of_m
call module_procedure_of_m(code_green)
"use m, only: hidden_type" is definitely invalid. I would expect that also
"print *, code_green" and "print *, code_green%code" is invalid.
According to NAG is for Fortran 95 "type(hidden_type), public" already wrong.
I will try to find the relevant part in the Fortran 95 and 2003 standard (is
probably a bit hidden).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33106
More information about the Gcc-bugs
mailing list