This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/23764] New: Implicit conversion to a reference for an object broken
- From: "rlyle at ritual dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Sep 2005 15:39:17 -0000
- Subject: [Bug c++/23764] New: Implicit conversion to a reference for an object broken
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Trying to compile the following code on a FreeBSD 5.4 machine, using GCC
4.0.1....
# 1 "Test.cpp"
# 0 "<built-in>"
# 1 "<command line>"
# 1 "Test.cpp"
class OutStream
{
public:
OutStream();
};
inline OutStream & operator<<( OutStream & output, const int & value )
{
return output;
}
class Client
{
public:
OutStream send()
{
return OutStream();
}
};
int main(int argc,char **argv)
{
Client myclient;
int x = 32;
int y = 64;
myclient.send() << x << y;
return 0;
}
Produces the following output...
Using built-in specs.
Target: i386-portbld-freebsd5.4
Configured with: ./..//gcc-4.1-20050730/configure --disable-nls --with-system-
zlib --with-libiconv-prefix=/usr/local --program-suffix=41 --
libdir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0 --with-gxx-include-
dir=/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/c++/ --disable-
shared --disable-rpath --prefix=/usr/local i386-portbld-freebsd5.4
Thread model: posix
gcc version 4.1.0 20050730 (experimental)
/usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.1.0/cc1plus -E -quiet -v
Test.cpp -fpch-preprocess -o Test.ii
ignoring nonexistent directory "/usr/local/lib/gcc/i386-portbld-
freebsd5.4/4.1.0/gcc/i386-portbld-freebsd5.4/4.1.0/../../../../i386-portbld-
freebsd5.4/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/c++/
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/c++//i386-portbld-
freebsd5.4
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/include/c++//backward
/usr/local/include
/usr/local/lib/gcc/i386-portbld-freebsd5.4/4.1.0/gcc/i386-portbld-
freebsd5.4/4.1.0/include
/usr/include
End of search list.
/usr/local/libexec/gcc/i386-portbld-freebsd5.4/4.1.0/cc1plus -fpreprocessed
Test.ii -quiet -dumpbase Test.cpp -auxbase Test -version -o Test.s
GNU C++ version 4.1.0 20050730 (experimental) (i386-portbld-freebsd5.4)
compiled by GNU C version 4.1.0 20050730 (experimental).
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: c62afa56bfea22d68bd8bf2d1f862a27
Test.cpp: In function 'int main(int, char**)':
Test.cpp:33: error: no match for 'operator<<' in 'myclient. Client::send() <<
x'
Test.cpp:11: note: candidates are: OutStream& operator<<(OutStream&, const
int&)
--
Summary: Implicit conversion to a reference for an object broken
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rlyle at ritual dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23764