[Bug fortran/54756] [OOP] [F08] Should reject CLASS, intent(out) in PURE procedures

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 6 10:10:00 GMT 2012


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

--- Comment #3 from janus at gcc dot gnu.org 2012-11-06 10:10:35 UTC ---
Related test case:


module moda
 implicit none
 type t
  real, pointer :: p => null()
 end type t
contains

 pure subroutine s1(a,b)
  type(t), intent(in) :: b
  class(t), allocatable, intent(out) :: a
   allocate(a,source=b)
 end subroutine

 pure subroutine s2(a,b)
  type(t), intent(in) :: b
  class(t), allocatable, intent(out) :: a
   allocate(t::a)
   a%p => b%p
 end subroutine

end module  



(slightly modified version of the one posted at
https://groups.google.com/forum/?fromgroups=#!topic/comp.lang.fortran/Vj6a0tM5cvs)


Currently only the second case is rejected due to "Bad target in pointer
assignment in PURE procedure". Possibly the same should apply to the first one?

Anyway, both should be rejected due to the CLASS, INTENT(OUT) argument.



More information about the Gcc-bugs mailing list