Dear Steve et al. at Intel,
The code shown below fails to compile with error #6303 using Intel Fortran compiler version 13.1.0.149.
It compiles successfully with gfortran 4.9 and executes as I would expect.
Would it be possible for you to review the code for correctness using the latest version of Intel compiler and if kosher, can you please consider adding this to your tracking system?
This seems related to the issues discussed in this forum topic, http://software.intel.com/en-us/forums/topic/506013, but in an opposite sense. That is, in that topic, the situation was a failure by the compiler to check a standards violation but in this case, the compiler seems to flag an error when there may not be any.
Thanks much,
MODULE TestMod !.. Explicit declarations IMPLICIT NONE !.. All entities private PRIVATE !.. Accessor class TYPE, ABSTRACT, PUBLIC :: MyPropClassAbstract CONTAINS PRIVATE PROCEDURE(SetAbstract), PASS(This), DEFERRED :: Set GENERIC, PUBLIC :: ASSIGNMENT(=) => Set END TYPE MyPropClassAbstract !.. Abstract Interface for Get, Set methods ABSTRACT INTERFACE PURE ELEMENTAL SUBROUTINE SetAbstract(This, Value) IMPORT :: MyPropClassAbstract !.. Argument list CLASS(MyPropClassAbstract), INTENT(OUT) :: This CLASS(*), INTENT(IN) :: Value END SUBROUTINE END INTERFACE !.. Integer Type TYPE, EXTENDS(MyPropClassAbstract), PUBLIC :: MyIntProp PRIVATE INTEGER :: MyValue CONTAINS PROCEDURE, PASS(This) :: Get => GetInt PROCEDURE, PASS(This) :: Set => SetInt GENERIC, PUBLIC :: ASSIGNMENT(=) => Get END TYPE MyIntProp CONTAINS !.. Get value of integer type PURE ELEMENTAL SUBROUTINE GetInt(Value, This) !.. Argument list INTEGER, INTENT(INOUT) :: Value CLASS(MyIntProp), INTENT(IN) :: This !.. Value = This%MyValue RETURN END SUBROUTINE GetInt !.. Set value of integer type PURE ELEMENTAL SUBROUTINE SetInt(This, Value) !.. Argument list CLASS(MyIntProp), INTENT(OUT) :: This CLASS(*), INTENT(IN) :: Value !.. Process based on input type SELECT TYPE (Value) TYPE IS (INTEGER) This%MyValue = Value CLASS DEFAULT !.. Insert error handling here RETURN END SELECT RETURN END SUBROUTINE SetInt END MODULE TestMod PROGRAM TestFor USE TestMod, ONLY : MyIntProp IMPLICIT NONE INTEGER :: I INTEGER :: J TYPE(MyIntProp) :: TestInt I = 5 TestInt = I J = TestInt WRITE(6,91) I, J STOP !.. Format statements 91 FORMAT(1X," I, J = ",I2,",",I2) END PROGRAM TestFor
The compiler response is as shown below:
1>------ Build started: Project: TestFor, Configuration: Debug Win32 ------ 1>Compiling with Intel(R) Visual Fortran Compiler XE 13.1.0.149 [IA-32]... 1>TestMod.f90 1>TestFor.f90 1c:\dev\Fortran\Test9\sor\TestFor.f90(12): error #6303: The assignment operation or the binary expression operation is invalid for the data types of the two operands. [I] 1>compilation aborted for c:\dev\Fortran\Test9\sor\TestFor.f90 (code 1) 1> 1>Build log written to "file://\c:\dev\Fortran\Test9\Debug\Win32\TestForBuildLog.htm" 1>TestFor - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========