[Patch,Fortran] Add polymorphic type support (OOP, RTTI) - merge from Fortran-dev branch

Tobias Burnus burnus@net-b.de
Wed Sep 30 22:21:00 GMT 2009


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



More information about the Gcc-patches mailing list