I'm confused about [dcl.array]/1:
In a declaration T D where D has the form
D1 [ constant-expressionopt ] attribute-specifier-seqopt
and the type of the identifier in the declaration T D1 is “derived-declarator-type-list T”, then the type of the identifier of D is an array type; ...
Consider the declaration:
int (*p)[42];
This declaration satisfies the grammar described above (and does not satisfy the grammar described in previous paragraphs), so this paragraph should apply, thus we conclude that the type of p
is an array type. However, we know that the type of p
is pointer to array of 42 int
, which is a pointer type.
Am I missing something? Or pointer to array of 42 int
is indeed an array type?
This is a bug of the wording of the standard. Of course, int (*p)[42];
is not an array type, but satisfies the grammar in [dcl.array]/1 (and does not satisfy the previous grammars in [dcl.meaning]/5, [dcl.meaning]/6, [dcl.ptr]/1, [dcl.ref]/1 or [dcl.mptr]/1), so [dcl.array]/1 should apply.
I have posted an editorial issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With