Quantcast
Channel: Recent posts
Viewing all articles
Browse latest Browse all 415

17.01 vs 17.02 private component inheritance problems

$
0
0

Hi,

the code below compiles with ifort 17.01 and gfortran 6.3, but not with ifort 17.02. The error message is:

"A private component name is accessible only within the module containing the type definition.   [A]
    this%a=1"

Module Mod_Parent
  Type, Abstract :: parent
    Integer, private :: a
  contains
    Procedure(SubSetA), Pass, deferred :: SetA
  End type parent
  Abstract Interface
    Subroutine SubSetA(this)
      Import parent
      Class(parent), Intent(InOut) :: this
    end subroutine
  end Interface
  Private :: SubSetA
End Module Mod_Parent
Module Mod_Child
  use Mod_Parent
  Type, extends(parent) :: Child
  contains
    Procedure, Pass :: SetA => SubSetA
  End type Child
  Interface
    Module Subroutine SubSetA(this)
      Class(child), Intent(InOut) :: this
    end subroutine
  end Interface
  Private :: SubSetA
End Module Mod_Child
Submodule(Mod_Child) Set
Contains
  Module Procedure SubSetA
    this%a=1
  End Procedure
End Submodule Set
Program Test
  use Mod_Child
  Type(Child) :: x
  call x%setA()
End Program Test

Is the code not standard compliant or is it a compiler bug. I thought the "inheritance vs private" clash was resolved with the advent of submodules.

Any idea?


Viewing all articles
Browse latest Browse all 415

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>