type t integer :: i class(t), allocatable :: foo end type t In Fortran 2003 this is invalid to have CLASS(T) in the same TYPE as the one being defined. I think Fortran 2008 allows this, but as currently, deallocating also does not work, I would simply reject it.
C438 (R440) If the POINTER attribute is not specified for a component, the declaration-type-spec in the component-def-stmt shall be CLASS(*) or shall specify an intrinsic type or a previously defined derived type. C439 (R440) If the POINTER attribute is specified for a component, the declaration-type-spec in the component-def-stmt shall be CLASS(*) or shall specify an intrinsic type or any accessible derived type including the type being defined. -- Summary: [OOP] Reject CLASS(T) as component of "TYPE :: T" Product: gcc Version: 4.5.0 Status: UNCONFIRMED Keywords: rejects-valid Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41585