This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33106] Access of components of public entities of private types wrongly allowed
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Aug 2007 17:50:44 -0000
- Subject: [Bug fortran/33106] Access of components of public entities of private types wrongly allowed
- References: <bug-33106-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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