- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am trying to define a simple procedure pointer with interface, but the code does not compile with ifort 12.1.5; however, it does compile and run with gfortran 4.6.3.
test.F90:
[fortran]
MODULE test_m
IMPLICIT NONE
TYPE,PUBLIC :: test
PROCEDURE(test1),POINTER :: test1ptr
END TYPE test
ABSTRACT INTERFACE
SUBROUTINE test1(THIS)
IMPORT
CLASS(test),INTENT(IN) :: THIS
END SUBROUTINE test1
END INTERFACE
PUBLIC :: temp
CONTAINS
SUBROUTINE temp(THIS)
IMPLICIT NONE
CLASS(test),INTENT(IN) :: THIS
WRITE (*,*) 'Hello world from the object!'
END SUBROUTINE temp
END MODULE test_m
[/fortran]
main.F90
[fortran]
PROGRAM helloworld
USE test_m
TYPE(test) :: tester
tester%test1ptr => temp
CALL tester%test1ptr()
END PROGRAM helloworld
[/fortran]
Ifort gives the following error when trying to compile test.F90 with ifort -c test.F90:
test.F90(6): error #6404: This name does not have a type, and must have an explicit type. [TEST1PTR]
PROCEDURE(test1),POINTER :: test1ptr
------------------------------^
compilation aborted for test.F90 (code 1)
Once again, the code compiles and runs with gfortran. Note: if you go back through test.F90 and remove passing, e.g., define the procedure pointer with NOPASS, take away THIS in the interface, etc. it will compile. It's hard for me to believe that a simple PASS would not be allowed!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page