On Sat, Oct 13, 2012 at 1:11 PM, Andreas Schwab <sch...@linux-m68k.org> wrote:
> Ian Lance Taylor <i...@google.com> writes:
>
>> Suppose you drop this into include/libiberty.h:
>>
>> #ifdef __cplusplus
>> inline char *lbasename(char *s) { return const_cast<char*>(lbasename (s)); }
>> #endif
>
> That doesn't work:
>
> ../../gcc/libcpp/../include/libiberty.h: In function ‘char* lbasename(char*)’:
> ../../gcc/libcpp/../include/libiberty.h:123:31: error: declaration of C 
> function ‘char* lbasename(char*)’ conflicts with
> ../../gcc/libcpp/../include/libiberty.h:121:20: error: previous declaration 
> ‘const char* lbasename(const char*)’ here

Hmmm, of course.

OK, your patch with CONST_CAST is OK.

Thanks.

Ian

Reply via email to