public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT>
@ 2005-04-26 23:21 bduerner at gmx dot de
2005-04-26 23:25 ` [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible pinskia at gcc dot gnu dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: bduerner at gmx dot de @ 2005-04-26 23:21 UTC (permalink / raw)
To: gcc-bugs
__cache_type;" in std::numpunct<CharT> makes specialisation impossible
X-Bugzilla-Reason: CC
It is not possible to specialise std::numpunct<CharT> defined
in /bits/locale_facets.h. in a portable way due to "typedef
__numpunct_cache<_CharT>
__cache_type;" within the std::numpunct<CharT> template.
This bug seems to be present at least in 3.4.4 and 4.0 but not 3.3.4.
--
Summary: conflicting "typedef __numpunct_cache<_CharT>
__cache_type;" in std::numpunct<CharT> makes
specialisation impossible
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bduerner at gmx dot de
CC: bduerner at gmx dot de,gcc-bugs at gcc dot gnu dot org
GCC build triplet: 3.4.4 or 4.0.0
GCC host triplet: 3.4.4 or 4.0.0
GCC target triplet: 3.4.4 or 4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
@ 2005-04-26 23:25 ` pinskia at gcc dot gnu dot org
2005-04-27 8:24 ` pcarlini at suse dot de
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-26 23:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-04-26 23:25 -------
Do you have a testcase for this?
(Also changed the British spelling to the Americian spelling in the summary).
--
What |Removed |Added
----------------------------------------------------------------------------
GCC build triplet|3.4.4 or 4.0.0 |
GCC host triplet|3.4.4 or 4.0.0 |
GCC target triplet|3.4.4 or 4.0.0 |
Summary|conflicting "typedef |conflicting "typedef
|__numpunct_cache<_CharT> |__numpunct_cache<_CharT>
|__cache_type;" in |__cache_type;" in
|std::numpunct<CharT> makes |std::numpunct<CharT> makes
|specialisation impossible |specialization impossible
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
2005-04-26 23:25 ` [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible pinskia at gcc dot gnu dot org
@ 2005-04-27 8:24 ` pcarlini at suse dot de
2005-04-27 11:34 ` bduerner at gmx dot de
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2005-04-27 8:24 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |pcarlini at suse dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
2005-04-26 23:25 ` [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible pinskia at gcc dot gnu dot org
2005-04-27 8:24 ` pcarlini at suse dot de
@ 2005-04-27 11:34 ` bduerner at gmx dot de
2005-04-27 12:13 ` pcarlini at suse dot de
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bduerner at gmx dot de @ 2005-04-27 11:34 UTC (permalink / raw)
To: gcc-bugs
------- 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
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (2 preceding siblings ...)
2005-04-27 11:34 ` bduerner at gmx dot de
@ 2005-04-27 12:13 ` pcarlini at suse dot de
2005-04-29 9:39 ` pcarlini at suse dot de
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2005-04-27 12:13 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-04-27 12:12 -------
Thanks for the testcase. The issue is subtle and the typedef is only the tip of
the iceberg: num_get (involved in >>(int)) uses the caching facilities provided
by the primary numpunct, which a specialization simply misses, generally. As our
library is currently designed, you cannot specialize numpunct and then use the
primary num_get template with it. Maybe we have a slighlty different instance
of the problem with istream members that we fixed for 4.0: we should have generic
implementations of num_get (and num_put) not exploitng any numpunct-provided
caching and efficient specializations for char and wchar_t. Seems doable, at
the expense of a non-trivial code-growth, but maybe within the present ABI.
Benjamin?
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |bkoz at redhat dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (3 preceding siblings ...)
2005-04-27 12:13 ` pcarlini at suse dot de
@ 2005-04-29 9:39 ` pcarlini at suse dot de
2005-04-29 10:25 ` pcarlini at suse dot de
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2005-04-29 9:39 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-04-29 09:39 -------
Hum, maybe the fix is much simpler than I thought :)
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |pcarlini at suse dot de
|dot org |
Status|UNCONFIRMED |ASSIGNED
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-04-29 09:39:07
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (4 preceding siblings ...)
2005-04-29 9:39 ` pcarlini at suse dot de
@ 2005-04-29 10:25 ` pcarlini at suse dot de
2005-04-29 18:51 ` cvs-commit at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2005-04-29 10:25 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-04-29 10:24 -------
Indeed it is, sorry for the false alarm: our design is correct as-is, only the
typedef should be changed, I'm finishing testing the fix.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (5 preceding siblings ...)
2005-04-29 10:25 ` pcarlini at suse dot de
@ 2005-04-29 18:51 ` cvs-commit at gcc dot gnu dot org
2005-05-09 19:59 ` cvs-commit at gcc dot gnu dot org
2005-05-09 20:01 ` pcarlini at suse dot de
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-29 18:51 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-04-29 18:50 -------
Subject: Bug 21238
CVSROOT: /cvs/gcc
Module name: gcc
Changes by: paolo@gcc.gnu.org 2005-04-29 18:50:01
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: locale_facets.tcc
libstdc++-v3/testsuite: testsuite_character.cc
testsuite_character.h
Added files:
libstdc++-v3/testsuite/22_locale/num_get: 3.cc
libstdc++-v3/testsuite/22_locale/num_put: 3.cc
libstdc++-v3/testsuite/22_locale/money_get: 3.cc
libstdc++-v3/testsuite/22_locale/money_put: 3.cc
Log message:
2005-04-29 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/21238
* include/bits/locale_facets.tcc (num_get::_M_extract_float,
num_get::_M_extract_int, num_get::do_get(bool&),
num_put::_M_insert_int, num_put::_M_insert_float,
num_put::do_put(bool), money_get::_M_extract,
money_put::_M_insert): Adjust the __cache_type typedef not to
forward to a numpunct/moneypunct typedef.
* testsuite/testsuite_character.h: Add pod_uint and its numpunct
and moneypunct specializations.
* testsuite/testsuite_character.cc: Add numpunct<pod_uint>::id
and moneypunct<pod_uint>::id.
* testsuite/22_locale/num_get/3.cc: New.
* testsuite/22_locale/num_put/3.cc: Likewise.
* testsuite/22_locale/money_get/3.cc: Likewise.
* testsuite/22_locale/money_put/3.cc: Likewise.
* include/bits/locale_facets.tcc (money_put::_M_insert,
time_get::_M_extract_name): Prefer operator== to operator!=
on char_types.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2985&r2=1.2986
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&r1=1.214&r2=1.215
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/testsuite_character.cc.diff?cvsroot=gcc&r1=1.2&r2=1.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/testsuite_character.h.diff?cvsroot=gcc&r1=1.4&r2=1.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_get/3.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_put/3.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_get/3.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_put/3.cc.diff?cvsroot=gcc&r1=NONE&r2=1.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (6 preceding siblings ...)
2005-04-29 18:51 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-09 19:59 ` cvs-commit at gcc dot gnu dot org
2005-05-09 20:01 ` pcarlini at suse dot de
8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-05-09 19:59 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cvs-commit at gcc dot gnu dot org 2005-05-09 19:59 -------
Subject: Bug 21238
CVSROOT: /cvs/gcc
Module name: gcc
Branch: gcc-4_0-branch
Changes by: paolo@gcc.gnu.org 2005-05-09 19:59:17
Modified files:
libstdc++-v3 : ChangeLog
libstdc++-v3/include/bits: locale_facets.tcc
libstdc++-v3/testsuite: testsuite_character.h
testsuite_character.cc
Added files:
libstdc++-v3/testsuite/22_locale/num_get: 3.cc
libstdc++-v3/testsuite/22_locale/num_put: 3.cc
libstdc++-v3/testsuite/22_locale/money_get: 3.cc
libstdc++-v3/testsuite/22_locale/money_put: 3.cc
Log message:
2005-05-09 Paolo Carlini <pcarlini@suse.de>
PR libstdc++/21238
* include/bits/locale_facets.tcc (num_get::_M_extract_float,
num_get::_M_extract_int, num_get::do_get(bool&),
num_put::_M_insert_int, num_put::_M_insert_float,
num_put::do_put(bool), money_get::_M_extract,
money_put::_M_insert): Adjust the __cache_type typedef not to
forward to a numpunct/moneypunct typedef.
* testsuite/testsuite_character.h: Add pod_uint and its numpunct
and moneypunct specializations.
* testsuite/testsuite_character.cc: Add numpunct<pod_uint>::id
and moneypunct<pod_uint>::id.
* testsuite/22_locale/num_get/3.cc: New.
* testsuite/22_locale/num_put/3.cc: Likewise.
* testsuite/22_locale/money_get/3.cc: Likewise.
* testsuite/22_locale/money_put/3.cc: Likewise.
* include/bits/locale_facets.tcc (money_put::_M_insert,
time_get::_M_extract_name): Prefer operator== to operator!=
on char_types.
Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2917.2.43&r2=1.2917.2.44
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/include/bits/locale_facets.tcc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.211.12.3&r2=1.211.12.4
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/testsuite_character.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.2.54.2&r2=1.2.54.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/testsuite_character.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.3.4.2&r2=1.3.4.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_get/3.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/num_put/3.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_get/3.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/testsuite/22_locale/money_put/3.cc.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.4.1
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
` (7 preceding siblings ...)
2005-05-09 19:59 ` cvs-commit at gcc dot gnu dot org
@ 2005-05-09 20:01 ` pcarlini at suse dot de
8 siblings, 0 replies; 10+ messages in thread
From: pcarlini at suse dot de @ 2005-05-09 20:01 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pcarlini at suse dot de 2005-05-09 20:01 -------
Fixed for 4.0.1.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.0.1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21238
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-05-09 20:01 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-26 23:21 [Bug libstdc++/21238] New: conflicting "typedef __numpunct_cache<_CharT> bduerner at gmx dot de
2005-04-26 23:25 ` [Bug libstdc++/21238] conflicting "typedef __numpunct_cache<_CharT> __cache_type;" in std::numpunct<CharT> makes specialization impossible pinskia at gcc dot gnu dot org
2005-04-27 8:24 ` pcarlini at suse dot de
2005-04-27 11:34 ` bduerner at gmx dot de
2005-04-27 12:13 ` pcarlini at suse dot de
2005-04-29 9:39 ` pcarlini at suse dot de
2005-04-29 10:25 ` pcarlini at suse dot de
2005-04-29 18:51 ` cvs-commit at gcc dot gnu dot org
2005-05-09 19:59 ` cvs-commit at gcc dot gnu dot org
2005-05-09 20:01 ` pcarlini at suse dot de
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).