------- 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 
/usr/lib/gcc/i586-ark-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_facets.tcc:435:
 
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 { 
 
  template<> 
  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 { 
    public: 
      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; 
 
    public: 
      static locale::id id; 
 
    public: 
      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(); } 
 
    protected: 
      ~numpunct<MyChar>() 
        { } 
 
      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> { 
  public: 
    MyStream() : std::basic_iostream<MyChar>() 
    {} 
}; 
 
 
int main() { 
        MyStream mystream; 
 
        std::locale loc( mystream.getloc(), new std::numpunct<MyChar>() ); 
        mystream.imbue(loc); 
 
        int n; 
        mystream >> n; 
 
  return 0; 
} 
------------------------------------------------------------ 
-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bero at arklinux dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238

Reply via email to