conversion bug (char* -> char const *&)

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat Mar 4 04:48:00 GMT 2000


> 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



More information about the Gcc-bugs mailing list