From mboxrd@z Thu Jan 1 00:00:00 1970 From: bkoz@gcc.gnu.org To: bkoz@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: libstdc++/2767 Date: Tue, 08 May 2001 15:46:00 -0000 Message-id: <20010508224601.30603.qmail@sourceware.cygnus.com> X-SW-Source: 2001-05/msg00243.html List-Id: The following reply was made to PR libstdc++/2767; it has been noted by GNATS. From: bkoz@gcc.gnu.org To: bkoz@gcc.gnu.org, gcc-gnats@gcc.gnu.org, nobody@gcc.gnu.org, schmid@snake.iap.physik.tu-darmstadt.de, stephen@bregmasoft.com Cc: Subject: Re: libstdc++/2767 Date: 8 May 2001 22:45:34 -0000 Synopsis: Problems with the new bits/std_cstring.h header Responsible-Changed-From-To: unassigned->bkoz Responsible-Changed-By: bkoz Responsible-Changed-When: Tue May 8 15:45:34 2001 Responsible-Changed-Why: Responsible State-Changed-From-To: open->analyzed State-Changed-By: bkoz State-Changed-When: Tue May 8 15:45:34 2001 State-Changed-Why: Ugh. This can't be fixed without moving to the shadow headers: namespace swamp { extern "C" { extern char* strchr(const char *__s, int __c); } } namespace std { const char* strchr(const char* __s1, int __n) { return const_cast(swamp::strchr(__s1, __n)); } char* strchr(char* __s1, int __n) { return swamp::strchr(const_cast(__s1), __n); } } void f(const char* name) { using namespace std; strchr(name, int('/')); } This works, as long as you compile with -fno-builtin. Regardless, the current implementation is incorrect, as this declaration doesn't exist: extern "C" const char* strchr(const char*, int); should be extern "C" char* strchr(const char*, int); http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=2767&database=gcc