[Cfp-interest 2607] Re: [SC22WG14.22883] N3071 exactly representable
Jim Thomas
jaswthomas at sbcglobal.net
Fri Jan 13 16:27:55 PST 2023
Right. the statement and example are not consistent.
5.2.4.2.2 #21 says "If an optional unary + or − operator followed by a signaling NaN macro is used as the initializer for initializing an object of the same type that has static or thread storage duration, the object is initialized with a signaling NaN value.” I believe this applies to initialization of parts of a complex object. If so, the example should be:
constexpr double _Complex dc1 = DBL_SNAN; // ok
One problem here is that 5.2.4.2.2 #21 doesn’t cover constexpr but that should be fixed, e.g. by inserting “or that is declared with storage-class specifier constexpr” after "that has static or thread storage duration” (as has been proposed to accommodate constexpr in other place).
- Jim Thomas
> On Jan 13, 2023, at 2:35 PM, Joseph Myers <joseph at codesourcery.com> wrote:
>
> I'd like to make one comment on the changes CFP proposed for this issue in
> N3081:
>
> The proposed normative wording says "If the initializer has real type and
> a signaling NaN value, the unqualified versions of the type of the
> initializer and the corresponding real type of the object declared shall
> be compatible.". But then the examples include
>
> constexpr double _Complex dc1 = DBL_SNAN; // constraint violation
>
> and I think showing that example as a constraint violation is not
> consistent with the "corresponding real type" part of the normative
> wording - that is, this example might be shown as "ok", or conceivably
> argued to be unspecified whether it's OK, but shouldn't be shown as
> required to be a constraint violation given the normative text proposed.
>
> --
> Joseph S. Myers
> joseph at codesourcery.com
More information about the Cfp-interest
mailing list