This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
3697. Preconditions ofreference_constructs_from_temporary/reference_converts_from_temporary
seem wrong
Section: 21.3.6.4 [meta.unary.prop] Status: New Submitter: Jiang An Opened: 2022-05-10 Last modified: 2022-05-17
Priority: 3
View other active issues in [meta.unary.prop].
View all other issues in [meta.unary.prop].
View all issues with New status.
Discussion:
std::reference_constructs_from_temporary
and std::reference_converts_from_temporary
are only useful when T
is a reference type, and a reference type is always complete. Whenever T
is an incomplete object type, it's clear that these traits inherit from std::false_type
, without any further detection which may result in UB. However, when T
is X&
or X&&
where X
is an incomplete object type, UB may be needed because of the potentially problematic detection in std::is_constructible
or std::is_convertible
.
[2022-05-17; Reflector poll]
Set priority to 3 after reflector poll.
Proposed resolution:
This wording is relative to N4910.
Modify 21.3.3 [meta.type.synop], Table 46 ([tab:meta.unary.prop]) — "Type property predicates" — as indicated:
Table 46: Type property predicates [tab:meta.unary.prop] Template Condition Preconditions…
template<class T, class U>
struct reference_constructs_from_temporary;conjunction_v<is_reference<T>, is_constructible<T, U>>
istrue
, and the initializationT t(VAL<U>);
bindst
to a
temporary object whose lifetime is extended (6.8.7 [class.temporary]). IfT
is a reference type,remove_reference_t<T>
andU
T
shall be a complete type s,
cvvoid
, or an array s of unknown bound.template<class T, class U>
struct reference_converts_from_temporary;conjunction_v<is_reference<T>, is_convertible<U, T>>
istrue
, and the initializationT t = VAL<U>;
bindst
to a
temporary object whose lifetime is extended (6.8.7 [class.temporary]). IfT
is a reference type,remove_reference_t<T>
andU
shall be complete types,
cvvoid
, or arrays of unknown bound.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4