gfortran accepts this code while INTEL and SUN compilers reject it:

$> cat private.f90
MODULE foomod
TYPE :: footype
  PRIVATE
  integer :: dummy
END TYPE
END MODULE

PROGRAM foo_test
  USE foomod
  TYPE(footype) :: foo
  foo = footype(1)
END


$> sunf95 -w4 private.f90

  foo = footype(1)
        ^
"private.f90", Line = 11, Column = 9: ERROR: Derived type "FOOTYPE" has private
components, therefore a structure constructor must not be defined for this
type.

$> ifort -warn all private.f90
fortcom: Error: private.f90, line 11: The type of this structure constructor is
use associated with the PRIVATE fields attribute   [FOOTYPE]
  foo = footype(1)
--------^


-- 
           Summary: structure constructor not allowed if a USEd type has
                    private components
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dfranke at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32460

Reply via email to