Created on 2017-07-14.00:00:00 last changed 14 months ago
Additional notes (September, 2023)
Issue 2018 is a duplicate of this issue.
Proposed resolution (November, 2018):
Change 9.4.4 [dcl.init.ref] paragraph 4 as follows:
Given types “cv1 T1” and “cv2 T2”, “cv1 T1” is reference-related to “cv2 T2” if T1 is
the same type assimilar (7.3.6 [conv.qual]) to T2, or T1 is a base class of T2. “cv1 T1” is reference-compatible with “cv2 T2” if
T1 is reference-related to T2, or
T2 is “noexcept function” and T1 is “function”, where the function types are otherwise the same,
and cv1 is the same cv-qualification as, or greater cv-qualification than, cv2a prvalue of type “pointer to cv2 T2” can be converted to the type “pointer to cv1 T1” via a standard conversion sequence (7.3 [conv]). In all cases where thereference-related orreference-compatible relationship of two types is used to establish the validity of a reference binding, and T1 is a base class of T2and the standard conversion sequence would be ill-formed, a program that necessitates such a binding is ill-formedif T1 is an inaccessible (11.8 [class.access]) or ambiguous (6.5.2 [class.member.lookup]) base class of T2.
Notes from the April, 2018 teleconference:
CWG agreed with the proposed direction.
[Accepted as a DR at the February, 2019 meeting.]
In an example like
int *ptr; const int *const &f() { return ptr; }
What is returned is a reference to a temporary instead of binding directly to ptr. The rules for reference-related types should say that T is reference-related to U if U* can be converted to T* by a qualification conversion.
History | |||
---|---|---|---|
Date | User | Action | Args |
2023-09-16 06:41:53 | admin | set | messages: + msg7436 |
2020-12-15 00:00:00 | admin | set | messages: + msg6396 |
2020-12-15 00:00:00 | admin | set | status: drafting -> cd5 |
2018-04-11 00:00:00 | admin | set | messages: + msg6197 |
2018-04-11 00:00:00 | admin | set | status: open -> drafting |
2017-07-14 00:00:00 | admin | create |