public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: libstdc++/9444: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that
@ 2003-01-30  9:44 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-01-30  9:44 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, paolo, scmvs, val

Synopsis: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that

State-Changed-From-To: feedback->closed
State-Changed-By: paolo
State-Changed-When: Thu Jan 30 09:44:55 2003
State-Changed-Why:
    Ok, by now the issue seems completely clear to me.
    By the way, in case you really don't want to provide a
    parameterless constructor just inherit from
    std::iterator<std::input_iterator_tag, ...>

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


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

* Re: libstdc++/9444: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that
@ 2003-01-26 23:31 paolo
  0 siblings, 0 replies; 3+ messages in thread
From: paolo @ 2003-01-26 23:31 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, paolo, scmvs, val

Synopsis: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that

Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sun Jan 26 23:31:18 2003
Responsible-Changed-Why:
    Analyzed.
State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Sun Jan 26 23:31:18 2003
State-Changed-Why:
    In a nutshell, I do not agree. Indeed, the lines which you
    emphasize are from:
      _S_construct(..., forward_iterator_tag)
                        ^^^^^^^^^^^^^^^^^^^^
    Among the ISO C++ requirements for _forward_ iterators
    (24.1.3, Table 74) is the parameterless constructor.
    
    Paolo.

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


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

* libstdc++/9444: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that
@ 2003-01-26 22:56 val
  0 siblings, 0 replies; 3+ messages in thread
From: val @ 2003-01-26 22:56 UTC (permalink / raw)
  To: gcc-gnats; +Cc: scmvs


>Number:         9444
>Category:       libstdc++
>Synopsis:       g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Sun Jan 26 22:56:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Val Samko
>Release:        gcc version 3.2 (mingw special 20020817-1)
>Organization:
>Environment:
Win2K
>Description:
The following 100% ANSI C++ compliant code does not compile with g++, unless we add "it(){}" to "it" struct.
That is because of the following lines in  include\c++\3.2\bits\basic_string.tcc
-------------------
	// NB: Not required, but considered best practice.
	if (__builtin_expect(__beg == _InIter(), 0))
	  __throw_logic_error("attempt to create string with null pointer");
-------------------
note that `_InIter()` there, which requires iterator to have
a parameterless constructor.

===========================
#include <string>
#include <vector>
using namespace std;

struct it : public std::iterator<std::forward_iterator_tag, string::value_type>
{
	it(string::iterator i_) : i(i_) {}
	char& operator *() { return *i; }
	bool operator == (const it& i_) { return i == i_.i; }
	bool operator != (const it& i_) { return i != i_.i; }
	it& operator ++ () { ++i; return *this; }
	string::iterator i;
};

template<class Cont, class It>
	void foo(Cont& c, It f, It l) { typedef typename Cont::value_type vt; c.push_back(vt(f, l)); }
int main()
{
	string s1 = "querty";
	vector<string> s2;
	foo(s2, it(s1.begin()), it(s1.end()));
	return 1;
}
>How-To-Repeat:

>Fix:
Remove offending lines from 
include\c++\3.2\bits\basic_string.tcc
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2003-01-30  9:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-30  9:44 libstdc++/9444: g++ STL requires iterators passed to string constructor to have a constructor without parameters, but C++ standard does not require that paolo
  -- strict thread matches above, loose matches on Subject: below --
2003-01-26 23:31 paolo
2003-01-26 22:56 val

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