This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch,Fortran] Add polymorphic type support (OOP, RTTI) - merge from Fortran-dev branch
- From: Tobias Burnus <burnus at net-b dot de>
- To: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- Cc: Daniel Kraft <d at domob dot eu>, gfortran <fortran at gcc dot gnu dot org>, gcc patches <gcc-patches at gcc dot gnu dot org>, Paul Richard Thomas <paul dot richard dot thomas at gmail dot com>, Janus Weil <janus at gcc dot gnu dot org>
- Date: Wed, 30 Sep 2009 23:39:06 +0200
- Subject: Re: [Patch,Fortran] Add polymorphic type support (OOP, RTTI) - merge from Fortran-dev branch
- References: <4AC26DD8.8060001@net-b.de> <4AC35900.2040901@domob.eu> <4AC3BDA7.80300@net-b.de> <20090930203730.GA64090@troutmask.apl.washington.edu>
Steve Kargl wrote:
> On Wed, Sep 30, 2009 at 10:20:55PM +0200, Tobias Burnus wrote:
>
>> c) Allocation of abstract types requires a type spec or a SOURCE
>> type, abstract :: t
>> end type t
>> class(t), allocatable :: a
>> allocate(a) ! missing type-spec/source=
>> allocate(a, source=b) ! Wrong: b is abstract
>> ! though only checkable at runtime
>> end
> OK, I suppose I should go read the standard, but ...
> Why is b abstract, here? By implicit typing, b is
> default REAL, and it is undefined.
>
Because I could not decide whether I wanted that line or not. The third
line was supposed to be
class(t), allocatable :: a, b
The SOURCE=b argument is wrong for several reasons. (a) It is not
allocated and thus does not have a dynamic type - one should add a check
for this, either be default or with some -fcheck= option. (b) It is not
defined (for which checking is nontrivial)
Tobias