On Sat, Oct 13, 2012 at 11:23 AM, Andreas Schwab <sch...@linux-m68k.org> wrote:
> Ian Lance Taylor <i...@google.com> writes:
>
>> Why do you need the CONST_CAST?  strrchr is a standard function and it
>> takes const char * as the first argument.  There is other code in gcc
>> that calls strrchr with a const char * argument.
>
> strrchr is overloaded as const and non-const in C++.  We need the
> non-const version.

Oh yeah.  Really we should overload lbasename the same way.

Suppose you drop this into include/libiberty.h:

#ifdef __cplusplus
inline char *lbasename(char *s) { return const_cast<char*>(lbasename (s)); }
#endif

I'll preapprove that if it works.

Ian

Reply via email to