This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Bug 78640 - [F2015] gfortran accepts invalid allocatable polymorphic result in pure function


All,

I just submitted the text below as PR 78640.

Damian


Constraint C1589 in Draft 16-007r2 of the Fortran 2015 standard states

"A pure function shall not have a polymorphic allocatable result."

As demonstrated below, a 20161127 build of gfortran 7.0.0 accepts code that violates the above constraint:
 
$ cat poly-alloc-result.f90 
  type foo
  end type
  type(foo) :: bar
  bar = f()
contains
  pure function f() result(y)
    class(foo), allocatable :: y
    allocate(foo::y)
  end function
end 

$ gfortran poly-alloc-result.f90 

$ ./a.out

$ gfortran --version
GNU Fortran (MacPorts gcc7 7-20161127_0) 7.0.0 20161127 (experimental)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]