type, abstract :: t
  end type t
  class(t), allocatable :: a
  allocate(a)
is wrong. For the allocate one has to use either
  allocate(derived-type :: a)
or
  allocate(a, source=some_type_or_class)

One needs to reject this at compile time.

 * * *

Another interesting issue is:

type, abstract :: t
end type t
class(t), allocatable :: a,b
allocate(a, source=b)
end

That is invalid as "b" is not allocated, i.e. it does not have a dynamic type.
A check could/should be implemented at the same time as PR 41581.


-- 
           Summary: Allocation of abstract types requires a type spec or a
                    SOURCE
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          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=41582

Reply via email to