This is the mail archive of the
libstdc++-prs@sources.redhat.com
mailing list for the libstdc++ project.
libstdc++/78: compiler error on basic_string template
- To: libstdc++-gnats at sourceware dot cygnus dot com
- Subject: libstdc++/78: compiler error on basic_string template
- From: samuel dot fryer at kodak dot com
- Date: 28 Jul 2000 14:51:45 -0000
- Reply-To: samuel dot fryer at kodak dot com
- Resent-Cc: libstdc++-prs at sourceware dot cygnus dot com
- Resent-Reply-To: libstdc++-gnats@sourceware.cygnus.com, samuel.fryer@kodak.com
>Number: 78
>Category: libstdc++
>Synopsis: compiler error on basic_string template
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Jul 28 07:57:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator: Sam Fryer
>Release: 2.95.2 (19991024) AND 2.96 (20000722)
>Organization:
>Environment:
RedHat 6.2 on a dual P3
>Description:
A transcript of my session explains it best:
$ more x.cpp
#include <std/bastring.h>
template class basic_string<wchar_t>;
$ g++ -c x.cpp
.../include/g++-3/std/bastring.h: In method `const charT *basic_string<charT, traits,
Allocator>::c_str () const [with charT = __wchar_t, traits = string_char_traits<__wchar_t>, Allocator =
__default_alloc_template<true, 0>]':
wstring.cpp:2: instantiated from here
.../include/g++-3/std/bastring.h:343: cannot convert `const char *' to `const
__wchar_t *' in return
>How-To-Repeat:
Create the x.cpp as shown in the description and
run "g++ -c x.cpp"
>Fix:
My solution (which probably isn't the optimal solution)
is shown in this diff:
*** bastring.h.orig Thu Jul 27 11:01:23 2000
--- bastring.h.new Thu Jul 27 14:26:41 2000
*************** private:
*** 340,346 ****
public:
const charT* c_str () const
! { if (length () == 0) return ""; terminate (); return data (); }
void resize (size_type n, charT c);
void resize (size_type n)
{ resize (n, eos ()); }
--- 340,346 ----
public:
const charT* c_str () const
! { if (length () == 0) return (const charT*)""; terminate (); return data (); }
void resize (size_type n, charT c);
void resize (size_type n)
{ resize (n, eos ()); }
>Release-Note:
>Audit-Trail:
>Unformatted: