This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible

------- Additional Comments From bduerner at gmx dot de  2005-04-27 11:33 -------
This testcase gives the following error: 
numpunct_test.cpp:106:   instantiated from here 
error: no type named `__cache_type' in `class std::numpunct<MyChar>' 
#include <streambuf> 
#include <exception> 
#include <string> 
#include <iostream> 
#include <locale> 
using namespace std; 
struct MyChar {}; 
namespace std { 
  struct char_traits<MyChar> { 
    typedef MyChar char_type; 
    typedef int int_type; 
    typedef streamoff off_type; 
    typedef off_t pos_type; 
    typedef mbstate_t state_type; 
    static void assign(char_type& c1, const char_type& c2) {} 
    static bool eq(const char_type& c1, const char_type& c2) {} 
    static bool lt(const char_type& c1, const char_type& c2) {} 
    static int compare(const char_type* c1, const char_type* c2, size_t n) {} 
    static size_t length(const char_type* s) {} 
    static const char_type* find(const char_type* s, size_t n, const char_type& 
a) {} 
    static char_type* move(char_type* s1, const char_type* s2, int_type n) {} 
    static char_type* copy(char_type* s1, const char_type* s2, size_t n) {} 
    static char_type* assign(char_type* s, size_t n, char_type a) {} 
    static char_type to_char_type(const int_type& c) {} 
    static int_type to_int_type(const char_type& c) {} 
    static bool eq_int_type(const int_type& c1, const int_type& c2) {} 
    static int_type eof() {} 
    static int_type not_eof(const int_type& c) {} 
  template <> 
  class numpunct<MyChar> : public locale::facet { 
      typedef MyChar char_type; 
      typedef basic_string<MyChar> string_type; 
      // BUG: I would need to include this internally used typedef 
      // to make it compile successfully. 
      // typedef __numpunct_cache<MyChar>  __cache_type; 
      static locale::id id; 
      explicit numpunct<MyChar>(size_t refs = 0) : locale::facet(refs) 
        { } 
      char_type decimal_point() const 
        { return this->do_decimal_point(); } 
      char_type thousands_sep() const 
        { return this->do_thousands_sep(); } 
      string grouping() const 
        { return this->do_grouping(); } 
      string_type truename() const 
        { return this->do_truename(); } 
      string_type falsename() const 
        { return this->do_falsename(); } 
        { } 
      virtual char_type do_decimal_point() const 
        { return MyChar(); } 
      virtual char_type do_thousands_sep() const 
        { return MyChar(); } 
      virtual string do_grouping() const 
        { return ""; } 
      virtual string_type do_truename() const 
        { /* whatever */ } 
      virtual string_type do_falsename() const 
        { /* whatever*/ } 
  std::locale::id std::numpunct<MyChar>::id; 
class MyStream : public std::basic_iostream<MyChar> { 
    MyStream() : std::basic_iostream<MyChar>() 
int main() { 
	MyStream mystream; 
	std::locale loc( mystream.getloc(), new std::numpunct<MyChar>() ); 
	int n; 
	mystream >> n; 
  return 0; 

           What    |Removed                     |Added
                 CC|                            |bero at arklinux dot org

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]