Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Important Update: Community Platform Migration​. Learn more​>
29647 Discussions

Compiler error with function pointer as component

jmcfarland101
Beginner
1,571 Views

I'm having trouble compiling some code that uses function pointers as derived type components. I'm getting a "Code 3" compiler error. I'm able to recreate the problem withthe simple 16 line test codebelow -- the test program compiles fine with g95. (I didn't specify interfaces for the procedure pointers, as when I start doing that I run into a different compiler error, which I believe has already been discussed on this forum).

This is my first post, so let me know if I need to provide more information.

Thanks.

[cpp]PROGRAM farg

  TYPE container
    PROCEDURE(), POINTER, nopass :: f
    PROCEDURE(), POINTER, nopass :: g
  END TYPE container

  PRINT*, 'Running program that does nothing'

CONTAINS

  SUBROUTINE setf(cont, func)
    TYPE(container) :: cont
    PROCEDURE(), POINTER :: func
    func => cont%f
  END SUBROUTINE setf
  
END PROGRAM farg[/cpp]
0 Kudos
1 Reply
Steven_L_Intel1
Employee
1,571 Views

Welcome to the forum and thanks for the bug report. I can reproduce this and will pass it on to the developers. Our issue number is DPD200110430.

0 Kudos
Reply