This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/13121] Inserting struct with valarray in map fails


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]