Modify

Opened 6 years ago

Closed 5 years ago

#6311 closed Bugs (fixed)

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 (1)

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

Download all attachments as: .zip

Change History (4)

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

Demonstrate the bug

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

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

comment:2 Changed 5 years ago by danieljames

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

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

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

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

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain igaztanaga.
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.