]>
Commit | Line | Data |
---|---|---|
d405059b | 1 | /* |
2 | From: Richard Kettlewell <rjk@sfere.greenend.org.uk> | |
3 | To: submit@bugs.debian.org | |
4 | Subject: Bug#46550: basic_string<wchar_t> can't be instantiated | |
5 | Date: Sun, 3 Oct 1999 22:49:50 +0100 | |
6 | ||
7 | Package: libstdc++2.9-dev | |
8 | Version: 2.91.60-5 | |
9 | ||
10 | Hi, | |
11 | ||
12 | This ought to work, but it doesn't: | |
13 | ||
14 | ------------------------------------------------------------------------ | |
15 | lyonesse$ cat t.cc | |
16 | */ | |
17 | ||
18 | #include <string> | |
19 | ||
20 | template basic_string<wchar_t>; | |
21 | ||
22 | /* | |
23 | lyonesse$ c++ -c t.cc | |
24 | /usr/include/g++-2/std/bastring.h: In method `const __wchar_t * basic_string<__wchar_t,string_char_traits<__wchar_t>,__default_alloc_template<true,0> >::c_str<__wchar_t, string_char_traits<__wchar_t>, alloc>() const': | |
25 | t.cc:3: instantiated from here | |
26 | /usr/include/g++-2/std/bastring.h:301: return to `const __wchar_t *' from `char *' | |
27 | lyonesse$ | |
28 | ------------------------------------------------------------------------ | |
29 | ||
30 | # DP: Here is a patch to /usr/include/g++-2/std/bastring.h which makes it | |
31 | # DP: work for me (though note that I have not tested the c_str() method as | |
32 | # DP: such): | |
33 | ||
34 | ------------------------------------------------------------------------ | |
35 | --- libstdc++/std/bastring.h.orig Sun Oct 3 22:32:06 1999 | |
36 | +++ libstdc++/std/bastring.h Sun Oct 3 22:36:17 1999 | |
37 | @@ -332,7 +332,8 @@ | |
38 | ||
39 | public: | |
40 | const charT* c_str () const | |
41 | - { if (length () == 0) return ""; terminate (); return data (); } | |
42 | + { const charT* null_str = ""; | |
43 | + if (length () == 0) return null_str; terminate (); return data (); } | |
44 | void resize (size_type n, charT c); | |
45 | void resize (size_type n) | |
46 | { resize (n, eos ()); } |