public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6375: GCC errouneously chooses operators
@ 2002-09-15 5:14 nathan
0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-15 5:14 UTC (permalink / raw)
To: aj, gcc-bugs, gcc-prs, nobody, pthomas, tiwai
Synopsis: GCC errouneously chooses operators
State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Sun Sep 15 05:14:45 2002
State-Changed-Why:
not a bug.
'double operator[](double) const' requires a qualification
conversion on this.
'int &operator[](int)' does not.
hence they are ambiguous conversion sequence
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6375
^ permalink raw reply [flat|nested] 2+ messages in thread
* c++/6375: GCC errouneously chooses operators
@ 2002-04-19 8:56 pthomas
0 siblings, 0 replies; 2+ messages in thread
From: pthomas @ 2002-04-19 8:56 UTC (permalink / raw)
To: gcc-gnats; +Cc: aj, tiwai
>Number: 6375
>Category: c++
>Synopsis: GCC errouneously chooses operators
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Fri Apr 19 08:56:19 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Philipp Thomas, SuSE Linux Ag
>Release: 3.1 20020415 (prerelease)
>Organization:
>Environment:
suse-linux-gnu
>Description:
Gcc errouneously decides that it has to choose operators
and then rejects the code. Output of g++ -v is:
Reading specs from /usr/lib/gcc-lib/i486-suse-linux/3.1/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/u
sr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --with-gxx-include-dir=/usr/i
nclude/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --libdir=/usr/lib --enable-checking i486-sus
e-linux
Thread model: posix
gcc version 3.1 20020415 (prerelease)
/usr/lib/gcc-lib/i486-suse-linux/3.1/cc1plus -v -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__E
LF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asyst
em=posix -D__NO_INLINE__ -D__STDC_HOSTED__=1 -D_GNU_SOURCE -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386_
_ -D__tune_i486__ c++_bug.cc -D__GNUG__=3 -D__DEPRECATED -D__EXCEPTIONS -D__GXX_ABI_VERSION=100 -quiet -dumpba
se c++_bug.cc -version -fmessage-length=0 -o /tmp/ccn7fscV.s
GNU CPP version 3.1 20020415 (prerelease) (cpplib) (i386 Linux/ELF)
GNU C++ version 3.1 20020415 (prerelease) (i486-suse-linux)
compiled by GNU C version 3.1 20020415 (prerelease).
#include "..." search starts here:
#include <...> search starts here:
/usr/include/g++
/usr/include/g++/i486-suse-linux
/usr/include/g++/backward
/usr/local/include
/usr/lib/gcc-lib/i486-suse-linux/3.1/include
/usr/i486-suse-linux/include
/usr/include
End of search list.
c++_bug.cc: In function `void bar()':
c++_bug.cc:15: choosing `double foo::operator[](double) const' over `int& foo::operator[](int)'
c++_bug.cc:15: because worst conversion for the former is better than worst conversion for the latter
c++_bug.cc:15: choosing `double foo::operator[](double) const' over `int& foo::operator[](int)'
c++_bug.cc:15: because worst conversion for the former is better than worst conversion for the latter
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="c++_bug.cc"
Content-Disposition: inline; filename="c++_bug.cc"
class foo
{
public:
int &operator[] (int x);
int operator[] (int x) const;
double operator[] (double x) const;
};
void bar()
{
foo arr;
arr[2] = 5; // OK
int i = arr[10]; // OK
double x = arr[0.5]; // ERROR
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-15 12:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-15 5:14 c++/6375: GCC errouneously chooses operators nathan
-- strict thread matches above, loose matches on Subject: below --
2002-04-19 8:56 pthomas
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).