public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size
@ 2013-06-21 8:55 thunderliu at gmail dot com
2013-06-21 8:59 ` [Bug libstdc++/57666] " thunderliu at gmail dot com
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: thunderliu at gmail dot com @ 2013-06-21 8:55 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
Bug ID: 57666
Summary: valarray<T>::operator= in c++11 mode does not adapt to
size
Product: gcc
Version: 4.7.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: thunderliu at gmail dot com
Non-member operators for valarray<> returns instance of _Expr<> (lazy
evaluation?), instead of another valarray<>. This is non-conforming but
probably not a bug. But if the returned value is assigned to another
valarray<>, c++11 requires operator= to be size-adapting, but 4.7.2 does not do
that for _Expr<>.
For example:
#include <valarray>
extern "C" int printf(const char *, ...);
int main()
{
typedef std::valarray<int> A;
A a(3), b(3), d;
d=a+b;
printf("%d\n", d.size()); // 0, incorrect
d=a;
printf("%d\n", d.size()); // 3, correct
}
(Preprocessed source attached.)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/57666] valarray<T>::operator= in c++11 mode does not adapt to size
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
@ 2013-06-21 8:59 ` thunderliu at gmail dot com
2013-06-21 9:10 ` redi at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: thunderliu at gmail dot com @ 2013-06-21 8:59 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
thunderliu at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Target| |x86_64-redhat-linux
--- Comment #1 from thunderliu at gmail dot com ---
Compile the code with -std=c++0x
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/57666] valarray<T>::operator= in c++11 mode does not adapt to size
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
2013-06-21 8:59 ` [Bug libstdc++/57666] " thunderliu at gmail dot com
@ 2013-06-21 9:10 ` redi at gcc dot gnu.org
2013-06-21 9:16 ` thunderliu at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2013-06-21 9:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to thunderliu from comment #0)
> Non-member operators for valarray<> returns instance of _Expr<> (lazy
> evaluation?), instead of another valarray<>. This is non-conforming but
> probably not a bug.
26.6.1 [valarray.syn]/3 "Any function returning a valarray<T> is permitted to
return an object of another type, provided all the const member functions of
valarray<T> are also applicable to this type."
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/57666] valarray<T>::operator= in c++11 mode does not adapt to size
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
2013-06-21 8:59 ` [Bug libstdc++/57666] " thunderliu at gmail dot com
2013-06-21 9:10 ` redi at gcc dot gnu.org
@ 2013-06-21 9:16 ` thunderliu at gmail dot com
2013-06-21 9:34 ` paolo.carlini at oracle dot com
2013-06-21 14:24 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: thunderliu at gmail dot com @ 2013-06-21 9:16 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
--- Comment #3 from thunderliu at gmail dot com ---
Sorry I missed that. But the remaining (which is the point of this bug) still
stands.
(In reply to Jonathan Wakely from comment #2)
> (In reply to thunderliu from comment #0)
> > Non-member operators for valarray<> returns instance of _Expr<> (lazy
> > evaluation?), instead of another valarray<>. This is non-conforming but
> > probably not a bug.
>
> 26.6.1 [valarray.syn]/3 "Any function returning a valarray<T> is permitted
> to return an object of another type, provided all the const member functions
> of valarray<T> are also applicable to this type."
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/57666] valarray<T>::operator= in c++11 mode does not adapt to size
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
` (2 preceding siblings ...)
2013-06-21 9:16 ` thunderliu at gmail dot com
@ 2013-06-21 9:34 ` paolo.carlini at oracle dot com
2013-06-21 14:24 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-21 9:34 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2013-06-21
Assignee|unassigned at gcc dot gnu.org |paolo.carlini at oracle dot com
Ever confirmed|0 |1
--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Yes, it's easy to fix.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug libstdc++/57666] valarray<T>::operator= in c++11 mode does not adapt to size
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
` (3 preceding siblings ...)
2013-06-21 9:34 ` paolo.carlini at oracle dot com
@ 2013-06-21 14:24 ` paolo.carlini at oracle dot com
4 siblings, 0 replies; 6+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-21 14:24 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57666
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
Target Milestone|--- |4.8.2
--- Comment #5 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Fixed mainline and 4.8.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2013-06-21 14:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-21 8:55 [Bug libstdc++/57666] New: valarray<T>::operator= in c++11 mode does not adapt to size thunderliu at gmail dot com
2013-06-21 8:59 ` [Bug libstdc++/57666] " thunderliu at gmail dot com
2013-06-21 9:10 ` redi at gcc dot gnu.org
2013-06-21 9:16 ` thunderliu at gmail dot com
2013-06-21 9:34 ` paolo.carlini at oracle dot com
2013-06-21 14:24 ` paolo.carlini at oracle dot com
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).