title: Fortran polymorphism in pointers
body: <p>I am trying to use pointers to create links between objects. Using Fortran and here is the code piece:</p>
  
  <pre><code> module base_pars_module
     type,abstract,public :: base_pars
     end type
   end module 
   module test_parameters_module
     use base_pars_module
     type, extends(base_pars) :: test_pars
       contains 
       procedure :: whoami
     end type
     contains
     function whoami(this) result(iostat)
       class( test_pars) :: this
       write(*,*) 'i am a derived type child of base_pars'
     end type
   end module
   module base_mask_module
     use base_pars module
       type, abstract , public :: base_mask
       class(base_pars),pointer :: parameters
     end type
  end module
  module test_mask_module
    use base_mask_module
    implicit none
    type, extends(base_mask) :: test_mask
    end type
  end module
  program driver
  type(test_pars) , target :: par_Test
  type(test_mask) :: mask_test
    iostat= par_test%whoami()
    mask_test%parameters=&gt;par_test
    iostat=mask_test%parameters%whoami()
  end program
  </code></pre>
  
  <p><code>parameters</code> at <code>base_mask_module</code> is a pointer with <code>base_pars</code> class. I would like to use this pointer to refer <code>par_test</code> object which is <code>test_pars</code> type that extends <code>base_pars</code> type. So the pointer and the target has the same class. But when I compile this it gives an error:</p>
  
  <pre><code> driver.f90:17.37:
  
  iostat=mask_test%parameters%whoami()
                                    1
  Error: 'whoami' at (1) is not a member of the 'base_pars' structure
  </code></pre>
  
  <p>Is it a bug or am i doing something wrong?</p>