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



--- Comment #17 from janus at gcc dot gnu.org 2012-11-16 12:33:00 UTC ---

(In reply to comment #16)

> One way to reject the abstract case in comment 11, would be to just do the

> checking, but not add the procedure to the operator list:



The only problem with the patch in comment 16 is that the error message it

gives on comment 11 ...



generic :: assignment(=) => assign

                               1

Error: Entity 'assign_it' at (1) is already present in the interface



... is technically not correct. 'assign_it' is not added twice, but in one case

is just the interface of the deferred type-boud procedure 'assign'. Instead, it

might be better to complain about 'Ambiguous interfaces' (since any

non-abstract extension of the type 'sort_t' will have to override/implement the

type-bound 'assign' with a procedure which is ambiguous to 'assign_it').



However, such an error about 'Ambiguous interfaces' is also missing for the

following case (which is still accepted):



module m_sort

  implicit none



  type, abstract :: sort_t

  contains

    generic :: assignment(=) => assign

    procedure(assign_ifc), deferred :: assign 

  end type



  abstract interface

    subroutine assign_ifc (lhs, rhs)

      import

      class(sort_t), intent(out) :: lhs

      class(sort_t), intent(in) :: rhs

    end subroutine

  end interface



  interface assignment(=)

    subroutine assign_it (lhs, rhs)

      import

      class(sort_t), intent(out) :: lhs

      class(sort_t), intent(in) :: rhs

    end subroutine

  end interface



end module

Reply via email to