This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/13121] Inserting struct with valarray in map fails
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Nov 2003 14:47:22 -0000
- Subject: [Bug libstdc++/13121] Inserting struct with valarray in map fails
- References: <20031119101223.13121.Uwe.Seimet@seimet.de>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From bangerth at dealii dot org 2003-11-19 14:47 -------
This is because this program
------------------
#include <valarray>
#include <iostream>
int main ()
{
std::valarray <int> v1(5);
std::valarray <int> v2;
v2 = v1;
std::cout << v1.size() << " " << v2.size() << std::endl;
}
-----------------------
when compiled with any gcc version returns
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ x.cc ; ./a.out
5 0
icc, for reference, returns "5 5". Both results are standards conforming,
since 26.3.2.2/1 reads: "...The resulting behavior is undefined if the
length of the argument array is not equal to the length of the *this
array."
What you do with your map is the following: you first create an entry
by using m[(void*)0], and only then do you assign to it, so the result
is fully conforming.
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13121