Open Bug 1770157 Opened 3 years ago Updated 1 year ago

RefPtr<Foo> foo = std::move(rawPtrToFoo); leads a bug

Categories

(Core :: MFBT, defect)

defect

Tracking

()

People

(Reporter: masayuki, Unassigned)

Details

Attachments

(1 obsolete file)

RefPtr and OwningNonNull have move constructors/operators to clear another strong pointer instance. However, if it's the argument is a raw pointer variable, it won't be cleared.

This is not unexpected behavior for C++ developers if and only if they are writing it and know that it's a raw pointer. So, in other words, if the source type is changed from a strong pointer to a raw pointer, such move constructors/operators become not used whether they are used.

Perhaps, if it's possible, move constructors/operators for raw pointer should be deleted (I don't know whether it's work). Or, std::move(T*) should be banned by the clang-plugin.

Severity: -- → S3
Attachment #9384719 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: