Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Error 8313 and grandparent types

jahern
Beginner
699 Views
Hello,

I get this error when compiling the following code with ifort 11.1.072 (20100414). Error msg:
[plain]test.F90(5): error #8313: A deferred binding is inherited by non-abstract type; It must be overridden   [INDEX]
      PROCEDURE(ReturnInt_Grandparent), DEFERRED :: Index
----------------------------------------------------^[/plain]
Code:
[fortran]MODULE testmod
   IMPLICIT NONE
   TYPE, ABSTRACT :: Grandparent
   CONTAINS
      PROCEDURE(ReturnInt_Grandparent), DEFERRED :: Index
   END TYPE Grandparent
   TYPE, ABSTRACT, EXTENDS(Grandparent) :: Parent
   END TYPE Parent
   ABSTRACT INTERFACE
      PURE FUNCTION ReturnInt_Grandparent(obj)
         IMPORT :: Grandparent
         CLASS(Grandparent), INTENT(IN) :: obj
         INTEGER :: ReturnInt_Grandparent
      END FUNCTION ReturnInt_Grandparent
   END INTERFACE
   TYPE, EXTENDS(Parent) :: Child ! works with EXTENDS(Grandparent)
      INTEGER :: items(10)
   CONTAINS
      PROCEDURE, NON_OVERRIDABLE :: Index => Index_Child
   END TYPE Child
CONTAINS
   PURE FUNCTION Index_Child(obj)
      IMPLICIT NONE
      CLASS(Child), INTENT(IN) :: obj
      INTEGER :: Index_Child
      Index_Child = SIZE(obj%items,1)
   END FUNCTION Index_Child
END MODULE testmod

PROGRAM test
   USE testmod
   IMPLICIT NONE
   TYPE(Child) :: a
   WRITE(*,*) a%Index()
END PROGRAM test[/fortran]
As noted, if I switch EXTENDS(Parent) to EXTENDS(Grandparent), this code compiles. I believe that this is an ifort error - in this case the "Parent" type is still abstract and should not need to override "Index", and the first non-abstract type ("Child") does do so.
Of course, it's possible that I'm in error! Let me know. FYI, I may have submitted a similar error report in the past, I should check...
Thanks!
Jared
0 Kudos
4 Replies
Steven_L_Intel1
Employee
699 Views
You did report a similar error in comp.lang.fortran and that one is fixed, but this variant is still broken. Thanks, I'll send this to the developers. I think your code is correct. Issue ID is DPD200154706.
0 Kudos
jahern
Beginner
699 Views
Thanks. Sorry to be a pest on this one! :)
0 Kudos
Steven_L_Intel1
Employee
699 Views
You are absolutely NOT a "pest"! We appreciate the reports, though of course wish we didn't have the bugs in the first place!
0 Kudos
Steven_L_Intel1
Employee
699 Views
I expect this issue to be resolved in Update 7, currently scheduled for August.
0 Kudos
Reply