https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111897

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The examples in 5.6.1 are not the standard, so are not authoritative.

The wording change in 5.7.3 alters [dcl.init.list] which is about list
initialization, which is not relevant here. That says that converting 1.0 to
_Float16 is not a narrowing conversion, but copy initialization (as used in
your example) doesn't reject narrowing conversions anyway. And this isn't a
-Wnarrowing warning.

Had you written `_Float16 A{1.0};` then it would be list-init, and I think the
warning is wrong for that case.

I think the relevant wording for your example is [dcl.init.general] p16 (16.9):

Otherwise, the initial value of the object being initialized is the (possibly
converted) value of the
initializer expression. A standard conversion sequence (7.3) is used to convert
the initializer expression
to a prvalue of the cv-unqualified version of the destination type; no
user-defined conversions are
considered. If the conversion cannot be done, the initialization is ill-formed.


The relevant kind of standard conversion sequence here is a floating-point
conversion, as defined in 7.3.10 [conv.double]. That does not permit
conversions to types of lesser rank. So the conversion is ill-formed.

Reply via email to