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

Access violation on calling member function of a type via polymorphic pointer

thomas_boehme
New Contributor II
645 Views
The code below produces an access violation on the call (IVF 11.1.038). I am quite sure that this should not happen with the given code.

I am not sure, if it is related to any of the other issues I have been reporting regarding the OO-features in v11.1

Best regards,
Thomas

[plain]    module TypeDefs

    implicit none

    type :: A
    integer :: val
    contains 
        procedure Display => DisplayA
    end type
        
    type, extends(A) :: B
        integer :: val2
    end type

    contains
    
    subroutine DisplayA( this )
    class (A)        :: this
        write (*,*) 'DisplayA: ', this%val
    end subroutine
        
    end module TypeDefs

    program Test
    use TypeDefs

    type (B), target        ::  Binst
    class (A), pointer      ::  ClassPtr
    
    Binst%val = 1
    Binst%val2 = 2
    
    ClassPtr => Binst
    CALL ClassPtr%Display

    end program Test
[/plain]



0 Kudos
2 Replies
TimP
Honored Contributor III
645 Views
The 11.1 compiler says ClassPtr is NULL. So this goes beyond the degree to which f2003 is implemented in the released compiler. Result from a newer ifort:
DisplayA: 1

0 Kudos
thomas_boehme
New Contributor II
645 Views
Quoting - tim18
The 11.1 compiler says ClassPtr is NULL. So this goes beyond the degree to which f2003 is implemented in the released compiler. Result from a newer ifort:
DisplayA: 1


Thanks for the info.

Any estimates on when this release will be available?

best regards,
Thomas
0 Kudos
Reply