public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9826: operator>>(basic_istream, basic_string) fails to compile with custom traits
@ 2003-03-08 13:36 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-03-08 13:36 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, peturr02

Synopsis: operator>>(basic_istream, basic_string) fails to compile with custom traits

State-Changed-From-To: analyzed->closed
State-Changed-By: paolo
State-Changed-When: Sat Mar  8 13:36:34 2003
State-Changed-Why:
    Fixed for 3.3 and 3.4.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9826


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libstdc++/9826: operator>>(basic_istream, basic_string) fails to compile with custom traits
@ 2003-02-25 19:02 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-02-25 19:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, peturr02

Synopsis: operator>>(basic_istream, basic_string) fails to compile with custom traits

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Tue Feb 25 19:02:00 2003
Responsible-Changed-Why:
    Patching.
State-Changed-From-To: open->analyzed
State-Changed-By: paolo
State-Changed-When: Tue Feb 25 19:02:00 2003
State-Changed-Why:
    Confirmed. Seems quite easy to fix (last famous words 2 ;)

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9826


^ permalink raw reply	[flat|nested] 3+ messages in thread

* libstdc++/9826: operator>>(basic_istream, basic_string) fails to compile with custom traits
@ 2003-02-24  9:26 peturr02
  0 siblings, 0 replies; 3+ messages in thread
From: peturr02 @ 2003-02-24  9:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         9826
>Category:       libstdc++
>Synopsis:       operator>>(basic_istream, basic_string) fails to compile with custom traits
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Feb 24 09:26:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     peturr02@ru.is
>Release:        gcc-3.2.1
>Organization:
>Environment:
Red Hat Linux 8.0
>Description:
If traits_type::int_type is not convertible to char_type, operator>>(basic_istream, basic_string) fails to compile.

This is because the implementation of this function passes an object of type int_type to ctype::is, this is a serious error also when int_type is int and char_type is char if char is signed.
>How-To-Repeat:
See attachment.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="inttypebug2.cc"
Content-Disposition: inline; filename="inttypebug2.cc"

#include <istream>
#include <streambuf>
#include <string>

struct MyChar
{
	int val;
};

struct MyInt
{
	long val;
};

class MyState
{
};

class MyTraits
{
public:
	typedef MyChar char_type;
	typedef MyInt int_type;
	typedef std::streampos pos_type;
	typedef std::streamoff off_type;
	typedef MyState 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* __s1, const char_type* __s2, 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, size_t __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);
};

class Buf : public std::basic_streambuf<MyChar, MyTraits>
{
};

int main()
{
	using namespace std;

	Buf buf;
	basic_string<MyChar, MyTraits> str;
	basic_istream<MyChar, MyTraits> stream(&buf);
	stream >> str;

	return 0;
}


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-03-08 13:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-08 13:36 libstdc++/9826: operator>>(basic_istream, basic_string) fails to compile with custom traits paolo
  -- strict thread matches above, loose matches on Subject: below --
2003-02-25 19:02 paolo
2003-02-24  9:26 peturr02

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).