can we know if an array definition has an explicit size ??

No.

int arr[3] = { 1, 2, 3 }

still get a ConstantArrayType.

Actually, if there’s no explict size, RecursiveASTVisitor::VisitIncompleteArrayType will get called, but in this function context, i can not get the source location (because the argument to VisitIncompleteArrayType is only a type, not a stmt).

Thanks

------------------ Original ------------------

Oh sorry, I misunderstood your question. See
<http://lists.cs.uiuc.edu/pipermail/cfe-dev/2012-August/023849.html&gt;
for an answer to almost exactly the same question. I'm pretty sure
that the getSizeExpr() will be null if there was none written.

-- Sean Silva