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

Andrew Benson <abenson at caltech dot edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abenson at caltech dot edu

--- Comment #16 from Andrew Benson <abenson at caltech dot edu> 2012-04-10 
21:06:13 UTC ---
The following compiles with "-std=f2003" and runs successfully (using gfortran
4.8 r186145) with the "a=b" line in, but if I switch it for the "a%d=b%d" line
I get a "Variable must not be polymorphic in intrinsic assignment at (1) -
check that there is a matching specific subroutine for '=' operator" error:

module testMod
  implicit none
  public t
  type t
     integer :: i
  end type t
  type c
     class(t), allocatable :: d
  end type c
end module testMod

program testProg
  use testMod
  implicit none
  type(t) :: f
  type(c) :: a,b
  allocate(b%d,source=f)
  b%d%i=12345

  a=b      !! THIS COMPILES OK
!  a%d=b%d   !! THIS DOES NOT

  write (0,*) a%d%i
  write (0,*) b%d%i
end program testProg

Since "d" is polymorphic both should be disallowed with "-std=f2003" (and both
allowed under F2008 I think).

Reply via email to