Modify

Ticket #6311 (closed Bugs: fixed)

Opened 2 years ago

Last modified 2 years ago

Broken const-ref semantics

Reported by: Akim Demaille <akim.demaille@…> Owned by: igaztanaga
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

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

Change History

Changed 2 years ago by Akim Demaille <akim.demaille@…>

Demonstrate the bug

comment:1 Changed 2 years ago by Akim Demaille <akim.demaille@…>

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

comment:2 Changed 2 years ago by danieljames

  • Owner changed from danieljames to igaztanaga
  • Component changed from unordered to move

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 Changed 2 years ago by danieljames

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

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

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.