This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115d. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-10-26
[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 onlyand where the reference binding (if any) binds directly.
- user-defined conversions,
- lvalue-to-rvalue conversions (7.3.2 [conv.lval]),
- array-to-pointer conversions (7.3.3 [conv.array]),
- function-to-pointer conversions (7.3.4 [conv.func]),
- qualification conversions (7.3.6 [conv.qual]),
- integral promotions (7.3.7 [conv.prom]),
- integral conversions (7.3.9 [conv.integral]) other than narrowing conversions (9.4.5 [dcl.init.list]),
- floating-point promotions (7.3.8 [conv.fpprom]),
- floating-point conversions (7.3.10 [conv.double]) where the source value can be represented exactly in the destination type,
- null pointer conversions (7.3.12 [conv.ptr]) from std::nullptr_t,
- null member pointer conversions (7.3.13 [conv.mem]) from std::nullptr_t, and
- function pointer conversions (7.3.14 [conv.fctptr]),