Created on 2023-08-07.00:00:00 last changed 8 months ago
Proposed resolution (approved by CWG 2023-09-15):
Change in 7.6.1.10 [expr.reinterpret.cast] paragraph 11 as follows:
A glvalue of type T1, designating an object or function x, can be cast to the type “reference to T2” if an expression of type “pointer to T1” can be explicitly converted to the type “pointer to T2” using a reinterpret_cast. The result is that of *reinterpret_cast<T2 *>(p) where p is a pointer to x of type “pointer to T1”. No temporary is created, no copy is made, and no constructors (11.4.5 [class.ctor]) or conversion functions (11.4.8 [class.conv]) are called. [ Footnote: ... ]
[Accepted as a DR at the November, 2023 meeting.]
Subclause 7.6.1.10 [expr.reinterpret.cast] paragraph 11 specifies:
A glvalue of type T1, designating an object x, can be cast to the type “reference to T2” if an expression of type “pointer to T1” can be explicitly converted to the type “pointer to T2” using a reinterpret_cast. The result is that of *reinterpret_cast<T2 *>(p) where p is a pointer to x of type “pointer to T1”. No temporary is created, no copy is made, and no constructors (11.4.5 [class.ctor]) or conversion functions (11.4.8 [class.conv]) are called. [ Footnote: ... ]
The wording does not cover references to function type, only references to object types. All major implementations accept the following example:
void f() {} void(&g())(int) { return reinterpret_cast<void(&)(int)>(f); }
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-05 21:43:46 | admin | set | status: dr -> drwp |
2023-12-19 10:15:28 | admin | set | status: ready -> dr |
2023-11-10 14:27:11 | admin | set | status: tentatively ready -> ready |
2023-09-15 21:51:11 | admin | set | messages: + msg7432 |
2023-09-15 21:51:11 | admin | set | status: open -> tentatively ready |
2023-08-07 00:00:00 | admin | create |