public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/59069] New: Bogus error wording for passing array to scalar dummies with user-defined operator
@ 2013-11-10 17:51 burnus at gcc dot gnu.org
2013-12-21 20:03 ` [Bug fortran/59069] " dominiq at lps dot ens.fr
0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-11-10 17:51 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59069
Bug ID: 59069
Summary: Bogus error wording for passing array to scalar
dummies with user-defined operator
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
The following error message is very misleading. The problem is not the type but
that the operands are arrays and the user-defined operator is not elemental:
print *, any( many == single )
1
Error: Operands of comparison operator '==' at (1) are
TYPE(latvec)/TYPE(latvec)
Found at https://groups.google.com/forum/#!topic/comp.lang.fortran/tuy1wUmVBkY
module Overloading
implicit none
type Latvec
integer :: hkl(3)
end type Latvec
interface operator (==)
procedure :: Latvec_equals
end interface operator (==)
contains
pure function Latvec_equals(latvec1, latvec2) result(equals)
implicit none
type(Latvec), intent(in) :: latvec1, latvec2
logical :: equals
equals = all(latvec1%hkl == latvec2%hkl)
end function Latvec_equals
end module Overloading
program Main
use Overloading
implicit none
type(Latvec) :: many(2) = [ Latvec([0,0,1]), Latvec([0,0,2]) ]
type(Latvec) :: single = Latvec([0,0,1])
! these work just fine
print *, single == many(1)
print *, single == many(2)
! this gives the compilation error:
! Operands of comparison operator '==' at (1) are TYPE(latvec)/TYPE(latvec)
print *, any( many == single )
end program Main
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/59069] Bogus error wording for passing array to scalar dummies with user-defined operator
2013-11-10 17:51 [Bug fortran/59069] New: Bogus error wording for passing array to scalar dummies with user-defined operator burnus at gcc dot gnu.org
@ 2013-12-21 20:03 ` dominiq at lps dot ens.fr
0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2013-12-21 20:03 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59069
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2013-12-21
Ever confirmed|0 |1
--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Indeed the error does not help to replace 'pure' with 'elemental'. Confirmed at
r206155.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-12-21 20:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-10 17:51 [Bug fortran/59069] New: Bogus error wording for passing array to scalar dummies with user-defined operator burnus at gcc dot gnu.org
2013-12-21 20:03 ` [Bug fortran/59069] " dominiq at lps dot ens.fr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).