Variable Length Array parameters in C++

I’ve been looking into the state of VLAs and variably-modified types in general in C++, and noticed that they actually seem quite well supported, at least for local variables. Functions with VLA parameters however are still a problem: you can define them, but you can’t actually call them, rendering them rather useless, e.g.:

extern void foo( int m, float x[m] );
void bar( float x[3] ) { foo( 3, x ); }

compiles in C mode but fails in C++ due to “no known conversion from ‘float ()[3]’ to 'float ()[m]’ for 2nd argument”.

I’ve made a feeble attempt at tracking down the root cause… I’ve noticed that in both cases the parameter in foo’s declaration gets correctly canonicalized to float ()[]. However, where C happily inserts an ImplicitCastExpr ‘float ()[]’ into the AST for the second argument to the call to foo(), C++ is unable to do the same. At this point I got hopelessly lost: I’ve not been able to locate where this ImplicitCastExpr is being generated, or why it is isn’t generated in C++ mode.

Intuitively I’d expect it should be relatively easy and safe to add the relevant implicit conversions to [*]-types, but I’m too unfamiliar with the clang codebase to have any idea on how to do such a thing.

Can anyone help here? It would be really awesome not being forced to choose between C+±without-VLA-parameters and C-with-VLA-parameters.

Matthijs