<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Look like it might be an in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033691#M111220</link>
    <description>&lt;P&gt;Look like it might be an ifort&amp;nbsp;bug regarding &amp;nbsp;'generic,public :: operator(+) =&amp;gt; add_real'.&amp;nbsp; Let me investigate a little bit and I'll get back to you.&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
    <pubDate>Thu, 23 Oct 2014 19:53:50 GMT</pubDate>
    <dc:creator>pbkenned1</dc:creator>
    <dc:date>2014-10-23T19:53:50Z</dc:date>
    <item>
      <title>OOP function overriding bug</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033690#M111219</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;When using a generic operator in an extended type, the operator binding is not added to the list from the ' mother' type. The compiler reject the code saying the operation is invalid. If you remove the operator in the extend type, everything is fine.&lt;/P&gt;

&lt;P&gt;Also, I'm testing overriding feature, and I do not really understand why function overriding is working but not when using the operator.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module test
type  :: my_integer
                integer, private :: value
        contains
                procedure,pass :: add_r =&amp;gt; add_my_integer_r
                generic,public :: operator(+) =&amp;gt; add_r
end type my_integer
type, extends(my_integer) :: my_integerr
        contains
                procedure,pass :: add_r =&amp;gt; add_my_integer_rr
                procedure,pass :: add_real
                generic,public :: operator(+) =&amp;gt; add_real
end type my_integerr

contains
function add_real(a,b) result(r)
        class(my_integerr),intent(in) :: a
        real,intent(in) :: b
        real :: r
        r=a%value+4d0*b
end function
function add_my_integer_rr(a,b) result(r)
        class(my_integerr),intent(in) :: a
        integer,intent(in) :: b
        integer :: r
        r=a%value+3*b
        print *,'overriding function'
end function
function add_my_integer_r(a,b) result(r)
        class(my_integer),intent(in) :: a
        integer,intent(in) :: b
        integer :: r
        r=a%value+b
end function
end module test
program toto
        use test
class(my_integer),allocatable :: t
class(my_integerr),allocatable :: tt
type(my_integerr),allocatable :: ttt
integer :: a

allocate(t,tt,ttt)
a=2
print *,'with operator'
print *,t+a
print *,tt+a
print *,ttt+a
print *,ttt+2.0

print *,'with function'
print *,t%add_r(a)
print *,tt%add_r(a)
print *,ttt%add_r(a)

end program toto&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Result in&amp;nbsp; :&lt;/P&gt;

&lt;P&gt;test2.f90(47): error #6355: This binary operation is invalid for this data type.&amp;nbsp;&amp;nbsp; [TT]&lt;BR /&gt;
	print *,tt+a&lt;BR /&gt;
	--------^&lt;BR /&gt;
	test2.f90(47): error #6549: An arithmetic or LOGICAL type is required in this context.&lt;BR /&gt;
	print *,tt+a&lt;BR /&gt;
	----------^&lt;BR /&gt;
	test2.f90(48): error #6355: This binary operation is invalid for this data type.&amp;nbsp;&amp;nbsp; [TTT]&lt;BR /&gt;
	print *,ttt+a&lt;BR /&gt;
	--------^&lt;BR /&gt;
	test2.f90(48): error #6549: An arithmetic or LOGICAL type is required in this context.&lt;BR /&gt;
	print *,ttt+a&lt;BR /&gt;
	-----------^&lt;BR /&gt;
	compilation aborted for test2.f90 (code 1)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 18:48:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033690#M111219</guid>
      <dc:creator>Patrice_l_</dc:creator>
      <dc:date>2014-10-23T18:48:09Z</dc:date>
    </item>
    <item>
      <title>Look like it might be an</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033691#M111220</link>
      <description>&lt;P&gt;Look like it might be an ifort&amp;nbsp;bug regarding &amp;nbsp;'generic,public :: operator(+) =&amp;gt; add_real'.&amp;nbsp; Let me investigate a little bit and I'll get back to you.&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Thu, 23 Oct 2014 19:53:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033691#M111220</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-10-23T19:53:50Z</dc:date>
    </item>
    <item>
      <title>I'm convinced this is an</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033692#M111221</link>
      <description>&lt;P&gt;I'm convinced this is an ifort bug regarding recognition of operator(+) for the extended type.&amp;nbsp; The code is standard-conforming Fortran and I don't see anything wrong with it.&amp;nbsp; I've reported this to the developers (internal ID DPD200362489).&amp;nbsp; I'll keep this thread updated with developments.&lt;/P&gt;

&lt;P&gt;Patrick&lt;/P&gt;</description>
      <pubDate>Fri, 24 Oct 2014 11:35:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033692#M111221</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2014-10-24T11:35:59Z</dc:date>
    </item>
    <item>
      <title>Hi,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033693#M111222</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I ran into another example slightly different but i think it is the same issue. The interface does not add up for a generic operator if a generic binding has alredy been defined. This gives an error for the "t1=t2", the error goes away if you comment the assignment copy&amp;nbsp; in type cm.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module types1
        implicit none
type cm
integer :: i
contains
        procedure,pass(t2) :: copy!_real=&amp;gt;copy_to_int
        generic,public :: assignment(=) =&amp;gt; copy
end type cm
type cm2
double precision :: j
contains
        procedure,pass(t2) :: to_int =&amp;gt; copy_to_int
        generic,public :: assignment(=) =&amp;gt; to_int
end type cm2


contains
subroutine copy(t1,t2)
class(cm),intent(out) ::t1
class(cm),intent(in) ::t2
t1%i=t2%i
end subroutine

subroutine copy_to_int(t1,t2)
        class(cm),intent(out) :: t1
        class(cm2),intent(in) :: t2

        t1%i=int(t2%j)
end subroutine
subroutine test()
class(cm),allocatable :: t1
class(cm2),allocatable :: t2
allocate(t1,t2)
t1=t2
end subroutine
end module
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Oct 2014 18:58:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033693#M111222</guid>
      <dc:creator>Patrice_l_</dc:creator>
      <dc:date>2014-10-29T18:58:50Z</dc:date>
    </item>
    <item>
      <title>The original test case is</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033694#M111223</link>
      <description>&lt;P&gt;The original test case is fixed in the 16.0 compiler, so I am closing this ticket now.&amp;nbsp; I tested this on Windows, but it shouldn't be any different on Linux or Mac.&amp;nbsp; If the outputs are incorrect, please reply.&lt;/P&gt;

&lt;P&gt;C:\ISN_Forums\U534286&amp;gt;ifort U534286.f90&lt;BR /&gt;
	Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.0.110 Build 20150815&lt;BR /&gt;
	Copyright (C) 1985-2015 Intel Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

&lt;P&gt;Microsoft (R) Incremental Linker Version 12.00.21005.1&lt;BR /&gt;
	Copyright (C) Microsoft Corporation.&amp;nbsp; All rights reserved.&lt;/P&gt;

&lt;P&gt;-out:U534286.exe&lt;BR /&gt;
	-subsystem:console&lt;BR /&gt;
	U534286.obj&lt;/P&gt;

&lt;P&gt;C:\ISN_Forums\U534286&amp;gt;U534286.exe&lt;BR /&gt;
	&amp;nbsp;with operator&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6226006&lt;BR /&gt;
	&amp;nbsp;overriding function&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;BR /&gt;
	&amp;nbsp;overriding function&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp; 8.000000&lt;BR /&gt;
	&amp;nbsp;with function&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6226006&lt;BR /&gt;
	&amp;nbsp;overriding function&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;BR /&gt;
	&amp;nbsp;overriding function&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6&lt;/P&gt;

&lt;P&gt;C:\ISN_Forums\U534286&amp;gt;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2015 20:29:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/OOP-function-overriding-bug/m-p/1033694#M111223</guid>
      <dc:creator>pbkenned1</dc:creator>
      <dc:date>2015-10-28T20:29:44Z</dc:date>
    </item>
  </channel>
</rss>

