See section 6.2 in ftp://ftp.nag.co.uk/sc22wg5/N1701-N1750/N1729.pdf.

In principle functions which return a pointer work already (even with procedure
pointers). AFAICS, the only thing missing is using these functions as lvalue,
as in this example:


real, dimension(1:100), target :: array
real, pointer :: p

array(5) = 0.7
print *,storage(5)

p => storage(3)
p = 0.5
print *,p

storage(5) = 0.5  ! Error: 'storage' at (1) is not a variable

contains

  function storage(key) result(loc)
    integer, intent(in) :: key
    real, pointer :: loc
    loc => array(key)
  end function

end


-- 
           Summary: Fortran 2008: Pointer functions as lvalue
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: janus at gcc dot gnu dot org
OtherBugsDependingO 39627
             nThis:


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

Reply via email to