This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: conversion bug (char* -> char const *&)
- To: wintermutesw at mindspring dot com
- Subject: Re: conversion bug (char* -> char const *&)
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Sat, 4 Mar 2000 13:41:33 +0100
- CC: egcs-bugs at egcs dot cygnus dot com
- References: <4.1.19990426153630.00926770@pop.mindspring.com>
> Looking at the 12/96 WP, char* -> char const *& should be a sequence
> of two exact matches, so I *think* this is a bug.
Thanks for your bug report. The mainline compiler (2.96 20000302
(experimental)) says
bug.cpp: In function `int main (...)':
bug.cpp:16: could not convert `Foo(v)' to `Foo &'
bug.cpp:11: in passing argument 1 of `foo (Foo &)'
which is true, because you can't bind temporaries to non-const
references. Also, there is no conversion from char* to char const*&,
since that would require a temporary, which cannot be bound to the
reference. After changing one of the references to const, your code
compiles fine.
Regards,
Martin