Skip to content

Commit 079b692

Browse files
committed
Clarify problem with copy and assign
1 parent daee5de commit 079b692

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

papers/P2988/optional_ref_wording.tex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ \section{Assignment of optional<T\&>}
389389
This observation allows us to provide only copy-assignment for \tcode{optional<T\&>}, instead of a set of converting assignments, that would need to replicate the signatures of constructors and their constraints. Assignment from any other value is handled by first implicitly constructing \tcode{optional<T\&>} and then using copy-assignment. Move-assignment is the same as copy-assignment, since only pointer copy is involved.
390390

391391
\section{Copy and Assignment of optional<U\&>\&\& to optional<T>}
392-
Care must be take to prevent the assignment of a movable optional to disallow the copy or assignment of the underlying referred to value to be stolen. The \tcode{optional<U\&> const\&} assignment or copy constructor should be used instead. We thank Jan Kokemüller for uncovering this bug.
392+
Care must be take to prevent the assignment of a movable optional to disallow the copy or assignment of the underlying referred to value to be stolen. The \tcode{optional<T>::optional<U\&> const\&} assignment or copy constructor should be used instead, which also needs to check slightly different constraints for \tcode{converts-from-any-cvref} and for testing \tcode{is_assignable}. We thank Jan Kokemüller for uncovering this bug. The bug seemns to be present in many optional implementations that support references.
393393

394394

395395
\chapter{Proposal}

0 commit comments

Comments
 (0)