This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/2767
- To: bkoz at gcc dot gnu dot org
- Subject: Re: libstdc++/2767
- From: bkoz at gcc dot gnu dot org
- Date: 8 May 2001 22:46:01 -0000
- Cc: gcc-prs at gcc dot gnu dot org,
- Reply-To: bkoz at gcc dot gnu dot org
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<const char*>(swamp::strchr(__s1, __n)); }
char*
strchr(char* __s1, int __n)
{ return swamp::strchr(const_cast<const char*>(__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