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

            Bug ID: 59547
           Summary: Problem with using tbp specification function in
                    multiple class procedures
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b...@miller-mohr.de

Created attachment 31470
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31470&action=edit
Error messages from gfortran 4.9.0

Hi,

this is a follow-up on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59450. The
ICE reported there got fixed (thanks). Verified this with 
GNU C version 4.9.0 20131217 (experimental).

However, there is still an issue with using a specification function in a class
procedure. When I use the function in multiple (tested with two) procedures, I
get errors on the function not being pure. However, when it is used in only one
procedure, this is not the case. The example I used is the following:

module classes

  implicit none

  type :: base_class
     integer :: member
   contains
     procedure, nopass :: get_num

     ! either of the lines below alone works, but not both together
     procedure :: get_array
     procedure :: get_array2
  end type

contains

  pure integer function get_num()
    get_num = 2
  end function

  function get_array( this ) result(array)
    class(base_class), intent(in) :: this
    integer, dimension( this%get_num() ) :: array
  end function

  function get_array2( this ) result(array)
    class(base_class), intent(in) :: this
    integer, dimension( this%get_num(), this%get_num() ) :: array
  end function

end module

I get the attached errors.

Cheers
Marcus

Reply via email to