http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45786

           Summary: Relational operators .eq. and == are not recognized as
                    equivalent
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: neil.n.carl...@gmail.com


The first paragraph of 7.2 in the standard states that "The operators <, ...
always have the same interpretations as the operators .LT., ..."  Consider the
following example:

module foo_type
  private
  public :: foo, operator(==)
  type :: foo
    integer :: bar
  end type
  interface operator(.eq.)
    module procedure eq_foo
  end interface
contains
  logical function eq_foo (a, b)
    type(foo), intent(in) :: a, b
    eq_foo = (a%bar == b%bar)
  end function
end module

subroutine use_it (a, b)
  use foo_type
  type(foo) :: a, b
  print *, a == b
end subroutine

The compiler incorrectly complains (essentially) that it has no == operator for
the operands when in fact it should -- it appears that the defined .EQ.
operator is not being treated as the same as == in the module.  Here's the
compiler error:

  print *, a == b
          1
Error: Operands of comparison operator '==' at (1) are TYPE(foo)/TYPE(foo)

-- 
Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

Reply via email to