This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2851. Allow floating-point conversions in converted constant expressions

Section: 7.7  [expr.const]     Status: DRWP     Submitter: Brian Bi     Date: 2023-11-03

[Accepted as a DR at the March, 2024 meeting.]

(From submission #456.)

With the adoption of P1907R1, non-type template parameters of floating-point types have been introduced. It is surprising that a double value cannot be passed as a template argument for a template parameter of type long double, because floating-point conversions are not allowed in converted constant expressions.

Proposed resolution (approved by CWG 2024-02-16):

Change in 7.7 [expr.const] paragraph 12 as follows:

A converted constant expression of type T is an expression, implicitly converted to type T, where the converted expression is a constant expression and the implicit conversion sequence contains only and where the reference binding (if any) binds directly.