Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28862 Discussions

Possible bug with ifx2025 - custom operator

gronki
Beginner
138 Views

I attach minimal example. Gfortran 14 seems to compile it fine.

module bugmod
    
    implicit none
    public
    type :: bugtree_t
    contains
        procedure, pass(tree) :: in_tree
        generic :: operator(.in.) => in_tree
        procedure, pass(tree) :: tree_has
        generic :: operator(.has.) => tree_has
    end type

    type, extends(bugtree_t) :: childtree_t
    end type

contains

    ! this seems fine
    elemental logical  function tree_has(tree, key) 
        class(*), intent(in) :: key
        class(bugtree_t), intent(in) :: tree
        tree_has = .false.
    end function

    ! this order will blow up later
    elemental logical function in_tree(key, tree)
        class(*), intent(in) :: key
        class(bugtree_t), intent(in) :: tree
        in_tree = .false.
    end function
end module

program testbugmod
    use bugmod

    type(bugtree_t) :: obj
    type(childtree_t) :: child
    print *, obj .has. "test"
    print *, "test" .in. obj
    print *, child .has. "test"
    ! below line causes problem
    ! print *, "test" .in. child
end program

Error:

test/bug.f90(43): error #6766: A binary defined OPERATOR definition is missing or incorrect.   [IN]
    print *, "test" .in. child
---------------------^
ifx --version
ifx (IFX) 2025.0.0 20241008
Copyright (C) 1985-2024 Intel Corporation. All rights reserved.
0 Replies
Reply