- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following code does not compile with Intel Fortran v16, v17, on x86-64 Linux:
module mymod implicit none type :: mytype private integer :: a contains procedure,private :: eq generic :: operator(==) => eq endtype mytype interface mytype module procedure :: constructor endinterface mytype contains type(mytype) function constructor(a) integer,intent(in),optional :: a if(present(a))then constructor % a = a else constructor % a = 0 endif endfunction constructor logical function eq(m0,m1) class(mytype),intent(in) :: m0 class(mytype),intent(in) :: m1 eq = m0 % a == m1 % a endfunction eq endmodule mymod module wrapper_module use mymod,only:mytype endmodule wrapper_module program test use wrapper_module implicit none write(*,*)mytype() == mytype(0) endprogram test
The compiler does not seem to resolve the overloaded == operator for mytype:
$ ifort test.f90 test.f90(44): error #6355: This binary operation is invalid for this data type. write(*,*)mytype() == mytype(0) ----------^ test.f90(44): error #6355: This binary operation is invalid for this data type. write(*,*)mytype() == mytype(0) ----------------------^ compilation aborted for test.f90 (code 1)
If the main program accesses mytype directly from mymod, the program compiles and executes as expected.
If the main program accesses mytype from wrapper_module, and wrapper module accesses mytype via "use mymod", the program compiles and executes as expected.
If the main program accesses mytype from wrapper_module, and wrapper module accesses mytype via "use mymod,only:mytype" (the example code above), the compilation fails with the above message. I think this is unexpected behavior.
The code compiles and executes as expected when compiled with gfortran 5.x
Thanks,
milan
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks - this is an issue we're already working on. Issue ID is DPD200374263.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Just a follow-up, the issue remains as of Intel Fortran 19.0.1.144 Build 20181018.
Cheers,
milan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This still seems to be present even in the latest compiler. Any updates on the Intel side?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For me this works with ifort v19.0.3 and v19.0.4 as well as with the beta version of 19.1.0. So it seems that this bug has been fixed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Juergen, it looks like it's time for an update. :)

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