[Bug fortran/45786] New: Relational operators .eq. and == are not recognized as equivalent
neil.n.carlson at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 24 23:45:00 GMT 2010
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: unassigned@gcc.gnu.org
ReportedBy: neil.n.carlson@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.
More information about the Gcc-bugs
mailing list