libstdc++/95: bastring.h's c_str implementation prohibits charT's other than char
ben@valinux.com
ben@valinux.com
Fri Oct 6 11:27:00 GMT 2000
>Number: 95
>Category: libstdc++
>Synopsis: bastring.h's c_str implementation prohibits charT's other than char
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Oct 06 11:27:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: ben@valinux.com
>Release: 2.95.2-13
>Organization:
>Environment:
debian potato
>Description:
The problem is that when you define use a template parameter for "charT"
for bastring as anything different than "char" the type that you pass in as the
template parameter doesn't match "" which is always of type "char*" when
g++ compiles the bastring.h header file.
>How-To-Repeat:
Try something like this:
#include <string>
int main()
basic_string<unsigned char> foo;
foo.c_str();
}
>Fix:
--- /usr/include/g++-3/std/bastring.h Fri Jul 7 02:10:00 2000
+++ bastring.h Fri Oct 6 10:55:14 2000
@@ -332,7 +332,7 @@
public:
const charT* c_str () const
- { const charT* null_str = "";
+ { static const charT null_str[1]={0};
if (length () == 0) return null_str; terminate (); return data (); }
void resize (size_type n, charT c);
void resize (size_type n)
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Libstdc++-prs
mailing list