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:14:59 +0200
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.

Of course, for templates you could always go back

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

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


Martin

Received on 2025-08-12 10:15:08