Title
Allow for call-compatible function types in reinterpret_cast
Status
tentatively ready
Section
7.6.1.10 [expr.reinterpret.cast]
Submitter
US

Created on 2025-10-01.00:00:00 last changed 2 days ago

Messages

Date: 2025-10-10.20:14:18

Proposed resolution (approved by CWG 2025-10-10):

Change in 7.6.1.10 [expr.reinterpret.cast] paragraph 6 as follows:

A function pointer can be explicitly converted to a function pointer of a different type. The function pointer value is unchanged by the conversion. [Note 4: The effect of calling a function through a pointer to a function type (9.3.4.6 [dcl.fct]) that is not the same as call-compatible with the type used in the definition of the function is undefined (7.6.1.3 [expr.call]). —end note] Except that converting a prvalue of type “pointer to T1” to the type “pointer to T2” (where T1 and T2 are function types) and back to its original type yields the original pointer value, the result of such a pointer conversion is unspecified.
Date: 2025-10-10.20:14:18
N5028 comment US 30-061

Subclause 7.6.1.10 [expr.reinterpret.cast] paragraph 6 does not, but should, make casts to call-compatible function types predictably valid.

History
Date User Action Args
2025-10-10 20:14:18adminsetmessages: + msg8141
2025-10-10 20:14:18adminsetstatus: open -> tentatively ready
2025-10-01 00:00:00admincreate