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

            Bug ID: 57508
           Summary: [OOP] Intrinsic assignment+defined-assignment for
                    comps: ROCEDURE attribute of '_F.DA0' conflicts with
                    VARIABLE attribute
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: pault at gcc dot gnu.org

The following code fails with the error message:

end module 
           1
Error: PROCEDURE attribute of '_F.DA0' conflicts with VARIABLE attribute at (1)


That's due to the support of calling defined assignment for the components in
an intrinsic assignment, which was added in GCC 4.8.

The _F.DA0 variable is generated in resolve.c's get_temp_from_expr.


module ForTrilinos_ref_counter
  type ref_counter
  contains
      procedure :: assign
      generic   :: assignment(=) => assign
  end type
contains
  subroutine assign (lhs, rhs)
    class (ref_counter), intent(inout) :: lhs
    class (ref_counter), intent(in) :: rhs
  end subroutine
end module
module FEpetra_BlockMap
  use ForTrilinos_ref_counter, only : ref_counter
  type :: Epetra_BlockMap 
    type(ref_counter) :: counter
  end type
contains
  function from_struct() result(new_Epetra_BlockMap)
    type(Epetra_BlockMap) :: new_Epetra_BlockMap
  end function
  type(Epetra_BlockMap) function create_arbitrary()
    create_arbitrary = from_struct()
  end function
end module

Reply via email to