shared_ptr::shared_ptr(Y*)
should be constrainedSection: 20.3.2.2.2 [util.smartptr.shared.const] Status: C++17 Submitter: United States Opened: 2017-02-03 Last modified: 2020-09-06
Priority: Not Prioritized
View other active issues in [util.smartptr.shared.const].
View all other issues in [util.smartptr.shared.const].
View all issues with C++17 status.
Discussion:
Addresses US 125
Paragraph 4: This constructor should not participate in overload
resolution unless the Requires clause is satisfied. Note that this would
therefore apply to some assignment operator and reset
overloads, via
Effects: equivalent to some code wording.
Proposed change:
Add a Remarks: clause to constrain this constructor not to participate in overload resolution unless the Requires clause is satisfied.
[2017-02-23, Jonathan provides wording]
Previous resolution [SUPERSEDED]:
This wording is relative to N4640.
Modify 20.3.2.2.2 [util.smartptr.shared.const] as indicated:
[Drafting note: This also adds a hyphen to "well defined"]
template<class Y> explicit shared_ptr(Y* p);-4- Requires:
-5- Effects: […] -6- Postconditions: […] -7- Throws: […] -?- Remarks: WhenY
shall be a complete type. The expressiondelete[] p
, whenT
is an array type, ordelete p
, whenT
is not an array type,shall be well formed,shall have well-defined behavior, and shall not throw exceptions.WhenT
isU[N]
,Y(*)[N]
shall be convertible toT*
; whenT
isU[]
,Y(*)[]
shall be convertible toT*
; otherwise,Y*
shall be convertible toT*
.T
is an array type, this constructor shall not participate in overload resolution unless the expressiondelete[] p
is well-formed and eitherT
isU[N]
andY(*)[N]
is convertible toT*
, orY(*)[]
is convertible toT*
. WhenT
is not an array type, this constructor shall not participate in overload resolution unless the expressiondelete p
is well-formed andY*
is convertible toT*
.
[Kona 2017-02-27: Jonathan updates wording after LWG review]
[Kona 2017-02-27]
Accepted as Immediate to resolve NB comment.
Proposed resolution:
This wording is relative to N4640.
Modify 20.3.2.2.2 [util.smartptr.shared.const] as indicated:
[Drafting note: This also adds a hyphen to "well defined"]
template<class Y> explicit shared_ptr(Y* p);-4- Requires:
-5- Effects: […] -6- Postconditions: […] -7- Throws: […] -?- Remarks: WhenY
shall be a complete type. The expressiondelete[] p
, whenT
is an array type, ordelete p
, whenT
is not an array type,shall be well formed,shall have well-defined behavior, and shall not throw exceptions.WhenT
isU[N]
,Y(*)[N]
shall be convertible toT*
; whenT
isU[]
,Y(*)[]
shall be convertible toT*
; otherwise,Y*
shall be convertible toT*
.T
is an array type, this constructor shall not participate in overload resolution unless the expressiondelete[] p
is well-formed and eitherT
isU[N]
andY(*)[N]
is convertible toT*
, orT
isU[]
andY(*)[]
is convertible toT*
. WhenT
is not an array type, this constructor shall not participate in overload resolution unless the expressiondelete p
is well-formed andY*
is convertible toT*
.