C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] VLA notation in parameter

From: Martin Uecker <ma.uecker_at_[hidden]>
Date: Tue, 12 Aug 2025 12:21:46 +0200
Am Dienstag, dem 12.08.2025 um 12:14 +0200 schrieb Martin Uecker:
> Am Dienstag, dem 12.08.2025 um 03:56 -0500 schrieb Nevin Liber via Liaison:
> > On Tue, Aug 12, 2025 at 2:35 AM Martin Uecker via Liaison <liaison_at_[hidden]> wrote:
> > > Yes. Sorry, I wasn't clear. My point was that if you wanted
> > > to avoid the "template" notation and write this with "auto"
> > > like this
> > >
> > > void foo(std::array<float, sizeof(b)>, auto b);
> > >
> > > this would not work.
> > >
> >
> >
> > Making use before declaration work in this case is a (potentially) breaking change, because this is valid:
> >
> > int b;
> > void foo(std::array<float, sizeof(b)>, auto b);
>
>
> This is exactly one of the concerns we also have regarding
> dependent attributes. For attributes it would not necessarily
> matter (depending on the attribute), but if one discusses changing
> name lookup rules in a more general context, this need to be
> considered.
>
> My question was if WG14 has more general solution / plan.

WG21

> Of course, for templates you could always go back
>
> template<typename B>
> void foo(std::array<float, sizeof(B), auto B);


template<typename B>
void foo(std::array<float, sizeof(B)>, B b)

>
> which then serves as a forwards declaration for the typename B.

Martin

>
>
> Martin
>
>
>
>

Received on 2025-08-12 10:21:51