Opened 11 years ago

Closed 11 years ago

#6311 closed Bugs (fixed)

Broken const-ref semantics

Reported by: Akim Demaille <akim.demaille@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: move
Version: Boost 1.48.0 Severity: Regression
Keywords: Cc:

Description

in Boost 1.48, unordered_maps seem to have lost the semantics of constrefs that "enl4rge your object lifetime".

The following runs are on a Mac OS X Lion, native clang++ 2.1 and native G++ 4.2. The latter is completely wrong. It used to be correct. Boost 1.48 installed via MacPorts.

clang++ 2.1
$ /tmp/foo.clang
make_map:   size: 2, bar => BAR, foo => FOO
return_map: size: 2, bar => BAR, foo => FOO
main:       size: 2, bar => BAR, foo => FOO

g++ 4.2
$ /tmp/foo.gcc
make_map:   size: 2, bar => BAR, foo => FOO
return_map: size: 0
main:       size: 0

Attachments (1)

foo.cc (732 bytes ) - added by Akim Demaille <akim.demaille@…> 11 years ago.
Demonstrate the bug

Download all attachments as: .zip

Change History (4)

by Akim Demaille <akim.demaille@…>, 11 years ago

Attachment: foo.cc added

Demonstrate the bug

comment:1 by Akim Demaille <akim.demaille@…>, 11 years ago

Using G++ 4.6 (from the MacPorts too), it works as expected.

comment:2 by Daniel James, 11 years ago

Component: unorderedmove
Owner: changed from Daniel James to Ion Gaztañaga

Sorry for the slow response, I only just got round to looking into this. It seems to be the case for any moveable classes implemented using Boost.Move so I'm reassigning this. It does appear to be a bug in g++ 4.2 (it's also present in g++ 4.0, but not in g++ 4.4 or later).

Boost.Move seems to be a bit too quirky, so I think I'm only going to implement the containers using Boost.Move if a macro is defined to opt in. Will still use Boost.Move for the elements.

comment:3 by Daniel James, 11 years ago

Resolution: fixed
Status: newclosed

(In [76531]) Unordered: Merge move changes. Fixes #6311.

Note: See TracTickets for help on using tickets.