Title
unique_ptr and shared_ptr fail to specify non-convertibility to int for unspecified-bool-type
Status
nad
Section
[unique.ptr.single.observers][util.smartptr.shared.obs]
Submitter
Beman Dawes

Created on 2007-06-14.00:00:00 last changed 164 months ago

Messages

Date: 2010-10-21.18:28:33

Proposed resolution:

To the Returns paragraph for operator unspecified-bool-type() const of [unique.ptr.single.observers] paragraph 11 and [util.smartptr.shared.obs] paragraph 16, add the sentence:

The return type shall not be convertible to int.

Date: 2010-10-21.18:28:33

[ Bellevue: ]

Close as NAD. Accepting paper N2435 makes it irrelevant.

Date: 2007-06-14.00:00:00

The standard library uses the operator unspecified-bool-type() const idiom in five places. In three of those places ([func.wrap.func.cap], function capacity for example) the returned value is constrained to disallow unintended conversions to int. The standardese is

The return type shall not be convertible to int.

This constraint is omitted for unique_ptr and shared_ptr. It should be added for those.

History
Date User Action Args
2010-10-21 18:28:33adminsetmessages: + msg3440
2010-10-21 18:28:33adminsetmessages: + msg3439
2007-06-14 00:00:00admincreate