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

Strange behavior with abstract type

Richard_M_1
Beginner
402 Views
[bash]MODULE Application PRIVATE TYPE, PUBLIC, ABSTRACT:: t_Application INTEGER*4:: status = 0 CONTAINS PROCEDURE, PASS(this):: Initialize PROCEDURE(Initialize), PASS(this), DEFERRED:: Run PROCEDURE(Initialize), PASS(this), DEFERRED:: Finalize END TYPE t_Application ABSTRACT INTERFACE FUNCTION Initialize(this) IMPORT:: t_Application CLASS(t_Application), INTENT(IN):: & this INTEGER*4:: Initialize END FUNCTION Initialize END INTERFACE END MODULE Application[/bash] If I make the Initialize procedure "DEFERRED", the compiler complains about needing an interface:

Error 1 error #8261: If DEFERRED attribute appears in the type bound procedure definition statement, an interface name must appear. [DEFERRED]

Since I have an interface name declared as an ABSTRACT INTERFACE, I don't see the problem.

If I remove the deferred for the Initialize bound procedure (as is done above), the code compiles.

Why can't I make all the bound procedures deferred?

Best,

Dick Munroe
0 Kudos
1 Reply
Richard_M_1
Beginner
402 Views
Never mind, I answered my own question when I dug a little further. The interface name is required in a deferred procedure. I assumed that the name that followed the PROCEDURE was a bound procedure name. When I read the specification a little more closely, I noticed that the name is an INTERFACE name.
Sorry for the waste of bandwidth.
Best,
Dick Munroe
0 Kudos
Reply