Modify

Ticket #5119 (closed Bugs: fixed)

Opened 3 years ago

Last modified 3 years ago

[C++0x] unordered_map doesn't support cp-ctor.

Reported by: pluto@… Owned by: danieljames
Milestone: Boost 1.47.0 Component: unordered
Version: Boost 1.45.0 Severity: Problem
Keywords: Cc: denis.arnaud_boost@…

Description

hi,

during compiling following testcase on gcc-4.6 snapshot i get an error.

#include <boost/unordered_map.hpp>

struct S
{
        boost::unordered_map<const void*, int > m_;
};

boost::unordered_map<const void*, S> m2_;

void foo ( const void* p )
{               
        S s;
        m2_.insert ( std::make_pair ( p, s ) );
}
(...)
include/c++/4.6.0/bits/stl_pair.h:110:17:
   error: 'constexpr std::pair<_T1, _T2>::pair(const std::pair<_T1, _T2>&)
   [with _T1 = const void* const, _T2 = S, std::pair<_T1, _T2>
      = std::pair<const void* const, S>]' is implicitly deleted because
          the default definition would be ill-formed:
.../include/c++/4.6.0/bits/stl_pair.h:110:17:
   error: use of deleted function 'S::S(const S&)

the major problem is a lack of copy constructor in unordered_map when compiled with -std=gnu++0x. the !defined(BOOST_NO_RVALUE_REFERENCES) activates only move semantics while documentation describes cp-ctor. http://www.boost.org/doc/libs/1_45_0/doc/html/boost/unordered_map.html#id1354372-bb

GCC bugzilla entry about this issue:  http://gcc.gnu.org/PR47417

Attachments

Change History

comment:1 Changed 3 years ago by danieljames

(In [68445]) Add copy constructors and assignment operators when using rvalue references. Refs #5119.

comment:2 Changed 3 years ago by danieljames

  • Status changed from new to assigned
  • Milestone changed from To Be Determined to Boost 1.47.0

That will hopefully fix it, but it's too late for 1.46.

I'm still seeing a lot of failures for gcc 4.6, but they also show up on gcc 4.5 and all seem to be exception related. Since they're not showing up on the regression tests, I suspect this is a problem with the macports version of gcc rather than a bug in boost or gcc in general.

comment:3 Changed 3 years ago by Denis Arnaud <denis.arnaud_boost@…>

  • Cc denis.arnaud_boost@… added

comment:4 Changed 3 years ago by danieljames

  • Status changed from assigned to closed
  • Resolution set to fixed

(In [69469]) Add copy constructors and assignment operators when using rvalue references. Fixes #5119.

View

Add a comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.