This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]