* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
@ 2005-12-08 3:36 ` gdr at integrable-solutions dot net
2006-01-10 10:37 ` chris at bubblescope dot net
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gdr at integrable-solutions dot net @ 2005-12-08 3:36 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from gdr at integrable-solutions dot net 2005-12-08 03:36 -------
Subject: Re: New: fill_n, generate_n assume Size is modifiable
"sebor at roguewave dot com" <gcc-bugzilla@gcc.gnu.org> writes:
| I came across this while gathering background for my post in
| c++std-lib-16112. I thgought I might as well let you know in case
| you think it's important enough to worry about (Size is only
| required to be convertible to an integral type which doesn't mean it
| needs to have the predecrement operator defined). The incorrect
| return type in this test case works around bug #25304.
I've come to take issue with the specification of Size. It says it is
convertible to an integral type, does it does not say which. I
believe the wording should be more precise -- yes, a library could
conservatively take long (long) or unsigned long (long), but still
that is a waste.
Would you mind appending that issue to the one you raised in
c++std-lib-16112?
-- gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
2005-12-08 3:36 ` [Bug libstdc++/25306] " gdr at integrable-solutions dot net
@ 2006-01-10 10:37 ` chris at bubblescope dot net
2006-01-10 16:14 ` sebor at roguewave dot com
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: chris at bubblescope dot net @ 2006-01-10 10:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from chris at bubblescope dot net 2006-01-10 10:37 -------
I'm unclear on why it should be convertable to one of the built-in integral
types at all.. surely saying that
iterator_traits<_OutputIterator>::difference_type (where _OutputIterator is the
first parameter to the function) would make more sense?
--
chris at bubblescope dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |chris at bubblescope dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
2005-12-08 3:36 ` [Bug libstdc++/25306] " gdr at integrable-solutions dot net
2006-01-10 10:37 ` chris at bubblescope dot net
@ 2006-01-10 16:14 ` sebor at roguewave dot com
2006-01-10 17:00 ` chris at bubblescope dot net
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: sebor at roguewave dot com @ 2006-01-10 16:14 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from sebor at roguewave dot com 2006-01-10 16:14 -------
(In reply to comment #2)
I'm not sure what you mean. Could you show what one of the algorithms would
look like with a Size that's not convertible to an integer?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (2 preceding siblings ...)
2006-01-10 16:14 ` sebor at roguewave dot com
@ 2006-01-10 17:00 ` chris at bubblescope dot net
2006-01-10 17:13 ` gdr at cs dot tamu dot edu
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: chris at bubblescope dot net @ 2006-01-10 17:00 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from chris at bubblescope dot net 2006-01-10 17:00 -------
For the record, I was thinking of:
template<typename _OutputIterator, typename _Size, typename _Tp>
_OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{
iterator_traits<_OutputIterator>::difference_type __count(__n)
for (; __count > 0; --__count, ++__first)
*__first = __value;
return __first;
}
But now I've decided thats no good, as difference_type isn't designed for
OutputIterators. Sorry.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (3 preceding siblings ...)
2006-01-10 17:00 ` chris at bubblescope dot net
@ 2006-01-10 17:13 ` gdr at cs dot tamu dot edu
2006-02-26 10:10 ` pcarlini at suse dot de
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: gdr at cs dot tamu dot edu @ 2006-01-10 17:13 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from gdr at cs dot tamu dot edu 2006-01-10 17:13 -------
Subject: Re: fill_n, generate_n assume Size is modifiable
"chris at bubblescope dot net" <gcc-bugzilla@gcc.gnu.org> writes:
| But now I've decided thats no good, as difference_type isn't designed for
| OutputIterators.
Indeed; and that is arguably a bug in the standard specification.
-- Gaby
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (4 preceding siblings ...)
2006-01-10 17:13 ` gdr at cs dot tamu dot edu
@ 2006-02-26 10:10 ` pcarlini at suse dot de
2006-02-26 11:01 ` pcarlini at suse dot de
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2006-02-26 10:10 UTC (permalink / raw)
To: gcc-bugs
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2006-02-26 10:09:47
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (5 preceding siblings ...)
2006-02-26 10:10 ` pcarlini at suse dot de
@ 2006-02-26 11:01 ` pcarlini at suse dot de
2010-05-21 15:29 ` paolo dot carlini at oracle dot com
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: pcarlini at suse dot de @ 2006-02-26 11:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #6 from pcarlini at suse dot de 2006-02-26 10:10 -------
For now...
--
pcarlini at suse dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |SUSPENDED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (6 preceding siblings ...)
2006-02-26 11:01 ` pcarlini at suse dot de
@ 2010-05-21 15:29 ` paolo dot carlini at oracle dot com
2010-05-21 16:57 ` paolo at gcc dot gnu dot org
2010-05-21 17:01 ` paolo dot carlini at oracle dot com
9 siblings, 0 replies; 11+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-21 15:29 UTC (permalink / raw)
To: gcc-bugs
------- Comment #7 from paolo dot carlini at oracle dot com 2010-05-21 15:29 -------
C++0x is not going to be much different here, thus let's fix the implementation
for now and be done with it.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |paolo dot carlini at oracle
|dot org |dot com
Status|SUSPENDED |ASSIGNED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (7 preceding siblings ...)
2010-05-21 15:29 ` paolo dot carlini at oracle dot com
@ 2010-05-21 16:57 ` paolo at gcc dot gnu dot org
2010-05-21 17:01 ` paolo dot carlini at oracle dot com
9 siblings, 0 replies; 11+ messages in thread
From: paolo at gcc dot gnu dot org @ 2010-05-21 16:57 UTC (permalink / raw)
To: gcc-bugs
------- Comment #8 from paolo at gcc dot gnu dot org 2010-05-21 16:57 -------
Subject: Bug 25306
Author: paolo
Date: Fri May 21 16:57:17 2010
New Revision: 159677
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=159677
Log:
2010-05-21 Paolo Carlini <paolo.carlini@oracle.com>
PR libstdc++/25306
* include/bits/stl_algobase.h (fill_n): Use a properly typed __niter
initialized to __n.
* include/bits/stl_algo.h (generate_n): Likewise.
* testsuite/25_algorithms/fill_n/25306.cc: New.
* testsuite/25_algorithms/generate_n/25306.cc: Likewise.
Added:
trunk/libstdc++-v3/testsuite/25_algorithms/fill_n/25306.cc
trunk/libstdc++-v3/testsuite/25_algorithms/generate_n/25306.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/stl_algo.h
trunk/libstdc++-v3/include/bits/stl_algobase.h
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread
* [Bug libstdc++/25306] fill_n, generate_n assume Size is modifiable
2005-12-08 2:41 [Bug libstdc++/25306] New: fill_n, generate_n assume Size is modifiable sebor at roguewave dot com
` (8 preceding siblings ...)
2010-05-21 16:57 ` paolo at gcc dot gnu dot org
@ 2010-05-21 17:01 ` paolo dot carlini at oracle dot com
9 siblings, 0 replies; 11+ messages in thread
From: paolo dot carlini at oracle dot com @ 2010-05-21 17:01 UTC (permalink / raw)
To: gcc-bugs
------- Comment #9 from paolo dot carlini at oracle dot com 2010-05-21 17:01 -------
Fixed for 4.6.0.
--
paolo dot carlini at oracle dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25306
^ permalink raw reply [flat|nested] 11+ messages in thread