http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48887

           Summary: [OOP] SELECT TYPE:  Associate name shall not be a
                    pointer/allocatable
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: accepts-invalid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: bur...@gcc.gnu.org
                CC: ja...@gcc.gnu.org, do...@gcc.gnu.org


>From F2008, 16.5.1.6 Construct association:

"If the selector is allocatable, it shall be allocated; the associate name is
associated with the data object and does not have the ALLOCATABLE attribute.

"If the selector has the POINTER attribute, it shall be associated; the
associate name is associated with the target of the pointer and does not have
the POINTER attribute."


However, gfortran accepts the following, ifort and NAG don't.

It works if the associate name is explicitly given using "associate-name =>
selector"; however, it does not change the POINTER/ALLOCATABLE issue as: "The
associate name of a SELECT TYPE construct is the associate-name if specified;
otherwise it is the name that constitutes the selector."


type t
end type t
class(t), allocatable :: alloc
class(t), pointer     :: ptr

select type(alloc)
type is (t)
  allocate(alloc) ! INVALID: "alloc" is not allocatable
end select

select type(ptr)
type is (t)
  nullify(ptr) ! INVALID: "ptr" is not a pointer
end select

end

For an longer example, see 
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/88b65a2c9024e95f

Reply via email to