I found this is a bug in my front end because I used the same type for the parameters in different functions, so the references to the parameter in the structure messed up.
The thing I want to implement is creating something like this pointers in C++ of structure type whose variably modified fields depend on other fields. So the problem is the reference of this parameter differs from function to function, and therefore, in the most straightforward solution, I have to deep copy the whole structure for each function, so it can correctly refer to the parameter. However, I want to avoid the deep copy. So, first, I guess it's not safe to share the same PARM_DECL among different functions, is it true? If true, is it possible to refer to the first parameter of whatever functions in the same way, so I can use the same type built upon that reference? And if so, at which stage, I can build such a reference? Thanks, Chenkan >> 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 >