[cfe-dev] A construct clang accepts and gcc don't. Who is right?

Paolo Bolzoni bolzoni at cs.unipr.it
Sun Dec 28 08:31:48 PST 2008


dear cfe-dev list,
I was trying to make a clang AST with a ConstantArrayType object with array
size modifier `static'.

The first try:
void f(int a[static 10]);

did not work because clang simplify the array parameter to a pointer.
So I thought to add a dimension, because you can't simplify a multi dimension
array to pointer and I tried:

void f(int a[10][static 10]);
and I had my ConstantArrayType object with size modifier `static'.

But gcc in the same code says:
`error: static or type qualifiers in non-parameter array declarator'
and fails the -fsyntax-only's checks.

So I have to two questions:
- About the first example is it possible having the AST nearer the source
  code keeping the array and not changing it to a pointer?
- About the second? Who is right?
Thanks

pb



More information about the cfe-dev mailing list