<?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 Re: error #6341 - ifx can't compile line like: if(aFunction) in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746568#M178780</link>
    <description>&lt;P&gt;why this definition doesn't work:&amp;nbsp;&lt;SPAN&gt;RECURSIVE LOGICAL FUNCTION aFunc()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How to define a function to return a&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;LOGICAL value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to compile Xeffort. It has a lost of this kind of call.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 03 May 2026 02:02:22 GMT</pubDate>
    <dc:creator>cean</dc:creator>
    <dc:date>2026-05-03T02:02:22Z</dc:date>
    <item>
      <title>error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746550#M178778</link>
      <description>&lt;P&gt;Here is a demo.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;! if_aFunc.f90
!======================================================================
! Compile with: 

! ifx if_aFunc.f90
!======================================================================
! Compiling Errors:

!Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2025.1.0 Build 20250317
!Copyright (C) 1985-2025 Intel Corporation. All rights reserved.

!if_afunc.f90(27): error #6385: The highest data type rank permitted is INTEGER(KIND=8).   [AFUNC]
!      if (aFunc(sText1)) print *,'false'
!----------^
!if_afunc.f90(27): error #6341: A logical data type is required in this context.   [AFUNC]
!      if (aFunc(sText1)) print *,'false'
!----------^
!compilation aborted for if_afunc.f90 (code 1)
!======================================================================
!source

      logical      :: iRet       
      iRet = aFunc(sText1)
      if (iRet) print *,'Work' 
      
      !Can't compile next line 
      if (aFunc(sText1)) print *,'Not Work.'
      end
!======================================================================
RECURSIVE LOGICAL FUNCTION aFunc()
      aFunc=.TRUE. 
END FUNCTION aFunc&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 02 May 2026 11:35:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746550#M178778</guid>
      <dc:creator>cean</dc:creator>
      <dc:date>2026-05-02T11:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746557#M178779</link>
      <description>&lt;P&gt;The compiler is correct, because aFunc is implicitly REAL and not allowed as the IF expression. It's possibly also a mismatch in your real application. Try this instead:&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;      logical      :: iRet, aFunc       
      iRet = aFunc(sText1)
      if (iRet) print *,'Work' 
      
      !Can't compile next line 
      if (aFunc(sText1)) print *,'Not Work.'
      end&lt;/LI-CODE&gt;</description>
      <pubDate>Sat, 02 May 2026 15:08:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746557#M178779</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2026-05-02T15:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746568#M178780</link>
      <description>&lt;P&gt;why this definition doesn't work:&amp;nbsp;&lt;SPAN&gt;RECURSIVE LOGICAL FUNCTION aFunc()&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;How to define a function to return a&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;LOGICAL value?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am trying to compile Xeffort. It has a lost of this kind of call.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2026 02:02:22 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746568#M178780</guid>
      <dc:creator>cean</dc:creator>
      <dc:date>2026-05-03T02:02:22Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746571#M178781</link>
      <description>&lt;P&gt;Here is a working example of your original code. It compiles and runs using the Intel ifx compiler (under Windows). It is necessary to ensure that the data types are explicitly declared. Using 'implicit none' will help you to ensure that this is the case.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="fortran"&gt;program prog_if_aFunc

implicit none

logical           :: aFunc, iRet
character(len=20) :: sText1

iRet = aFunc(sText1)
if (iRet) print *,'Works - iRet'

if (aFunc(sText1)) print *,'Works - aFunc'

end

!======================================================================

RECURSIVE LOGICAL FUNCTION aFunc(sText)
  implicit none
  character(len=*), intent(in) :: sText
  aFunc = .TRUE.
END FUNCTION aFunc&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;Below is the output:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="none"&gt; Works - iRet
 Works - aFunc&lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 03 May 2026 04:41:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746571#M178781</guid>
      <dc:creator>witwald</dc:creator>
      <dc:date>2026-05-03T04:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746572#M178782</link>
      <description>No, you have the redeclare in the main.&lt;BR /&gt;logical :: aFunc&lt;BR /&gt;&lt;BR /&gt;I don't want to add this.</description>
      <pubDate>Sun, 03 May 2026 05:52:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746572#M178782</guid>
      <dc:creator>cean</dc:creator>
      <dc:date>2026-05-03T05:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746600#M178783</link>
      <description>&lt;P&gt;The main program doesn't know the declaration of aFunc as it is a separate subprogram. Just having it in the same source file is not sufficient. Given this, you must declare it in the main program or from whichever program unit you call it from. You can avoid this by putting aFunc in a module and USEing the module in the main program,. or by making aFunc an internal subprogram of the main, after a CONTAINS.&lt;/P&gt;&lt;P&gt;For further reading, see my 2012 post&amp;nbsp;&lt;A href="https://stevelionel.com/drfortran/2012/01/05/doctor-fortran-gets-explicit-again/" target="_blank"&gt;Doctor Fortran Gets Explicit - Again! - Doctor Fortran&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2026 15:43:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746600#M178783</guid>
      <dc:creator>Steve_Lionel</dc:creator>
      <dc:date>2026-05-03T15:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746610#M178784</link>
      <description>&lt;P&gt;The compiler is not clairvoyant when it comes to using functions in a program. In the C programming language, this issue is gotten around by the use of header files. That way the compiler knows how to deal with a function when it encounters it. Of course, most Fortran compilers handle intrinsic functions, which are part of the language standard and are thus well defined, in the manner you are thinking of.&lt;/P&gt;</description>
      <pubDate>Sun, 03 May 2026 21:19:06 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746610#M178784</guid>
      <dc:creator>witwald</dc:creator>
      <dc:date>2026-05-03T21:19:06Z</dc:date>
    </item>
    <item>
      <title>Re: error #6341 - ifx can't compile line like: if(aFunction)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746619#M178785</link>
      <description>&lt;P&gt;Thanks all.&lt;/P&gt;&lt;P&gt;I got this question when trying to compile Xeffort.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Look at the code, it is in a module. Like the STRCMP function in xftstrings.f90&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 May 2026 01:07:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/error-6341-ifx-can-t-compile-line-like-if-aFunction/m-p/1746619#M178785</guid>
      <dc:creator>cean</dc:creator>
      <dc:date>2026-05-04T01:07:42Z</dc:date>
    </item>
  </channel>
</rss>

