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

2024-04-18


2168. Narrowing conversions and +/- infinity

Section: 9.4.5  [dcl.init.list]     Status: open     Submitter: Hubert Tong     Date: 2015-08-19

The intended treatment of a floating point infinity with respect to narrowing conversions is not clear. Is std::numeric_limits<double>::infinity() usable in a constant expression, for example, and should that be different from a calculation that results in an infinity?

Notes from the October, 2015 meeting:

CWG requests the assistance of SG6 in resolving this issue.

Notes from the November, 2016 meeting:

SG6 said that arithmetic operations (not conversions) that produce infinity are not allowed in a constant expression. However, using std::numeric_limits<T>::infinity() is okay, but it can't be used as a subexpression. Conversions that produce infinity from non-infinity values are considered to be narrowing conversions.