This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH, Fortran] PR fortran/77764 - ICE in is_anonymous_component
- From: Andre Vehreschild <vehre at gmx dot de>
- To: Fritz Reese <fritzoreese at gmail dot com>
- Cc: fortran <fortran at gcc dot gnu dot org>
- Date: Fri, 30 Sep 2016 15:43:40 +0200
- Subject: Re: [PATCH, Fortran] PR fortran/77764 - ICE in is_anonymous_component
- Authentication-results: sourceware.org; auth=none
- References: <CAE4aFAmZJUkUBPFi_jnz-14680y1x=XpjqHiapktvzyVKnGz-A@mail.gmail.com> <20160930104919.3b068d2d@vepi2> <CAE4aFA=6WZrcAL8BXHhV3DHCKESeA7RB+wk=9Vg2bp2-tD-+Uw@mail.gmail.com>
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