This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, Fortran] PR fortran/77764 - ICE in is_anonymous_component


Hi Fritz,

> Structures do not support inheritance, because they do not have a vptr
> or class_data, so they cannot be class objects. They are more like
> derived types with the SEQUENCE attribute, or like a C structure.
> 
> On the subject, technically, the following compiles and works as
> "expected", though I shudder to think of users mixing f90+ with
> pre-f66 extensions:
> 
> structure /t/
> integer :: why
> end structure
> 
> type (t), allocatable :: dont_do_this
> allocate (dont_do_this)
> dont_do_this.why = 5
> print *, dont_do_this.why
> 
> end

Thanks for the clarification. I was more involved in implementing newer
features from F2003 on. 

Strictly speaking (at least in gfortran notion) is "dont_do_this" not a class
object (the allocatable attribute doesn't make it one) and therefore doesn't
have a _vptr. It would only be a class object had the declaration be

class (t), allocatable :: dont_do_this

and this fortunately is rejected with:

Error: Type 't' of CLASS variable 'dont_do_this' at (1) is not extensible

So everthing fine.

Thanks again for the patch.

Regards,
	Andre
-- 
Andre Vehreschild * Email: vehre ad gmx dot de 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]