This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question on building a variably modified type at parameter scope
> I believe this should be possible. I believe that Ada has constructs
> like this. I think you will need to use a PLACEHOLDER_EXPR to get the
> right thing to happen.
In Ada, we indeed have the mechanism in its full generality, i.e.
struct S { int a; int b[a]; };
will work anywhere, and for this the PLACEHOLDER_EXPR machinery is needed.
But it seems to me that the case at stake is more specific:
void f (struct S { int a; int b[s.a]; } s) { }
because struct S is defined at parameter scope and s.a is a known object, so
perhaps the use of the (heavy) PLACEHOLDER_EXPR machinery could be avoided.
--
Eric Botcazou