C++ Logo

liaison

Advanced search

Re: [wg14/wg21 liaison] (SC22WG14.19245) constant expressions

From: Aaron Ballman <aaron_at_[hidden]>
Date: Mon, 12 Apr 2021 09:46:18 -0400
On Mon, Apr 12, 2021 at 9:39 AM Fred J. Tydeman <tydeman_at_[hidden]> wrote:
>
> On Mon, 12 Apr 2021 14:37:51 +0200 Jens Gustedt via Liaison wrote:
> >
> >Aaron,
> >
> >on Mon, 12 Apr 2021 07:59:03 -0400 you (Aaron Ballman
> ><aaron_at_[hidden]>) wrote:
> >
> >> Correcting the liaison email address so they're included.
> >>
> >> On Sun, Apr 11, 2021 at 5:12 AM Jens Gustedt <jens.gustedt_at_[hidden]>
> >> wrote:
> >
> >> > Lambda expressions already have a interesting incompatibility with
> >> > designators in initializers compared to C17, which I only found out
> >> > by the integration mentioned above. If we are in a world where
> >> > (implementation-defined) some constant objects can also be ICE, such
> >> > as
> >> >
> >> > int const something = 42;
> >>
> >> <tangent>Perhaps I'm misunderstanding 6.6p10, but I don't believe that
> >> gives you leave to turn this into an *integer constant expression*
> >> just a *constant expression*. ICE is a more specific term that has
> >> further semantic meaning elsewhere, and I was not under the impression
> >> implementations were allowed to define new kinds of integer constant
> >> expressions. e.g., I think it's invalid for an implementation to
> >> decide these are identical declarations: int foo[something]; and int
> >> foo[42];</tangent>
> >
> >interesting, I can read that differently.
> >
> >Such as that this phrase opens all the categories (ICE, address
> >constants, ...) that are introduced in that clause. I vaguely remember
> >that some implementation used that phrase to extend what they accept
> >as address constant.
>
> DR 312 against C99 has in the Committee Discussion:
>
> Even if an implementation accepts other forms of constant expressions, paragraph 6.6#10 does not change the definition of an integer constant expression given by paragraph 6.6#6, and int[(int)+1.0] is still a VLA.

Thank you for finding that, Fred!

~Aaron

>
> ---
> Fred J. Tydeman Tydeman Consulting
> tydeman_at_[hidden] Testing, numerics, programming
> +1 (702) 608-6093 Vice-chair of PL22.11 (ANSI "C")
> Sample C99+FPCE tests: http://www.tybor.com
> Savers sleep well, investors eat well, spenders work forever.

Received on 2021-04-12 08:46:32