<?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 Quote:Lorri Menard (Intel) in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127728#M133317</link>
    <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Lorri Menard (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;If what you care about is the integer field in TP2, then the quickest solution is to change line 78 to:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;equalsfunc = (this % var3 % var2 == obj % var3 %var2 )&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;@lanH, @Lorri,&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Thanks for your help. BTW, as var2 is private, the quickest solution may not work properly for the example.&lt;/P&gt;</description>
    <pubDate>Mon, 21 May 2018 14:50:47 GMT</pubDate>
    <dc:creator>Blane_J_</dc:creator>
    <dc:date>2018-05-21T14:50:47Z</dc:date>
    <item>
      <title>Error for binary operation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127725#M133314</link>
      <description>&lt;P&gt;Hi, the&amp;nbsp;&lt;SPAN style="font-size: 12px;"&gt;following code produces an error with ifort 2018u2 on x64 platform:&lt;/SPAN&gt;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module test1
    implicit none
    
    type, abstract :: tp1
        private
    contains
        private
        procedure(iequals), public, pass, deferred :: equals
    end type tp1
    
    abstract interface
        function iequals(this, obj)
            import tp1
            logical                :: iequals
            class(tp1), intent(in) :: this
            class(tp1), intent(in) :: obj
        end function iequals
    end interface
    
end module test1

module test2
    use test1, only: tp1
    implicit none
    
    type, extends(tp1) :: tp2
        private
        integer :: var2
    contains
        private
        procedure, public, pass :: equals =&amp;gt; equalsfunc
    end type tp2

    contains
    
    function equalsfunc(this, obj)
        implicit none

        logical                :: equalsfunc
        class(tp2), intent(in) :: this
        class(tp1), intent(in) :: obj

        select type(obj)
        type is(tp2)
            equalsfunc = (this % var2 == obj % var2)
        class default
            equalsfunc = .false.
        end select

    end function equalsfunc

end module test2

module test3
    use test1, only: tp1
    use test2, only: tp2
    implicit none
    
    type, extends(tp1) :: tp3
        private
        type(tp2) :: var3
    contains
        private
        procedure, public, pass :: equals =&amp;gt; equalsfunc
    end type tp3

    contains
    
    function equalsfunc(this, obj)
        implicit none

        logical                :: equalsfunc
        class(tp3), intent(in) :: this
        class(tp1), intent(in) :: obj

        select type(obj)
        type is(tp3)
            equalsfunc = (this % var3 == obj % var3)
        class default
            equalsfunc = .false.
        end select

    end function equalsfunc

end module test3&lt;/PRE&gt;

&lt;P&gt;Error message is:&lt;/P&gt;

&lt;P&gt;error #6355: This binary operation is invalid for this data type. &amp;nbsp; &amp;nbsp;[VAR3]&lt;/P&gt;

&lt;P&gt;on line 78. Is this a bug and is there any workaround that I can temporarily make it through ? Thanks for any help.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 03:16:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127725#M133314</guid>
      <dc:creator>Blane_J_</dc:creator>
      <dc:date>2018-05-21T03:16:17Z</dc:date>
    </item>
    <item>
      <title>There is no generic binding</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127726#M133315</link>
      <description>&lt;P&gt;There is no generic binding specification for ASSIGNMENT(=) in the code as shown. The error message makes sense if this is really the case.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 04:51:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127726#M133315</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2018-05-21T04:51:49Z</dc:date>
    </item>
    <item>
      <title>I hate disagreeing with Ian</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127727#M133316</link>
      <description>&lt;P&gt;I hate&amp;nbsp;disagreeing with Ian (it's almost as bad as&amp;nbsp;disagreeing with Steve) but I think the problem is that there is no defined operator&amp;nbsp;"==" specified for something of type TP2.&lt;/P&gt;

&lt;P&gt;the line in question is asking "is this%var3 the same as obj%var3" but there is nothing to define what "the same" means between two objects of type TP2.&lt;/P&gt;

&lt;P&gt;If what you care about is the integer field in TP2, then the quickest solution is to change line 78 to:&lt;/P&gt;

&lt;P&gt;equalsfun&lt;CODE class="fortran comment"&gt;c = (this % var3 % var2 == obj % var3 %var2 )&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Consolas"&gt;Or, you can create a defined operator for the "==" operator.&lt;/FONT&gt;&lt;/P&gt;

&lt;P&gt;&lt;FONT face="Consolas"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --Lorri&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 12:52:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127727#M133316</guid>
      <dc:creator>Lorri_M_Intel</dc:creator>
      <dc:date>2018-05-21T12:52:20Z</dc:date>
    </item>
    <item>
      <title>Quote:Lorri Menard (Intel)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127728#M133317</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Lorri Menard (Intel) wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;If what you care about is the integer field in TP2, then the quickest solution is to change line 78 to:&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;equalsfunc = (this % var3 % var2 == obj % var3 %var2 )&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;@lanH, @Lorri,&lt;/P&gt;

&lt;P style="font-size: 13.008px;"&gt;Thanks for your help. BTW, as var2 is private, the quickest solution may not work properly for the example.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 14:50:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127728#M133317</guid>
      <dc:creator>Blane_J_</dc:creator>
      <dc:date>2018-05-21T14:50:47Z</dc:date>
    </item>
    <item>
      <title>Oops - I muddled OPERATOR(==)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127729#M133318</link>
      <description>&lt;P&gt;Oops - I muddled OPERATOR(==) and ASSIGNMENT(=).&amp;nbsp; There's no generic binding specification for OPERATOR(==) in the code as shown, etc, etc.&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 19:22:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-for-binary-operation/m-p/1127729#M133318</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2018-05-21T19:22:53Z</dc:date>
    </item>
  </channel>
</rss>

