Hello!

The sample code below demonstrates the bug. Struct A is not inserted correctly
into the map m. When running the sample problem the output is:

5
0

but it should be

5
5


Best regards,   Uwe

--

#include <map>
#include <valarray>
#include <iostream>

struct A 
{
  std::valarray <int> v;
  A (int i=0)
    : v (i)
  {}
};

int main (int, char**)
{
  std::map <void*, std::pair <A, bool> > m;

  A a (5);
  std::cout << (a.v.size ()) << std::endl;
  m [(void*)0] = std::make_pair (a, false);

  std::cout << (m [(void*)0].first.v.size ()) << std::endl;
  return 0;
}

-- 
           Summary: Inserting struct with valarray in map fails
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Uwe dot Seimet at seimet dot de
                CC: Uwe dot Seimet at seimet dot de,gcc-bugs at gcc dot gnu
                    dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13121

Reply via email to