M
Michael Wojcik
Which constraint does it violate?
I think Arthur's wrong. Both 9899-1990 and N869 have a constraint for
the * unary operator, but it says only that the operand shall have
pointer type, not that the pointed-to type be complete. Contrast that
with, say, the constraint for the sizeof operator, which specifically
forbids incomplete types (though not, obviously, pointer types where
the pointed-to type is incomplete). Of course I may have missed some
other constraint elsewhere in the standard.
Also contrast with the constraint for array subscripting, which requires
that the first operand have "pointer to object type" - so dereferencing
a pointer to an incomplete type using array subscripting syntax would
be a constraint violation. (By 6.1.2.5 (C90) / 6.2.5 (N869), incomplete
types are not object types, so pointers to incomplete types are not
pointers to object types.)
In short:
extern struct foo *P;
*P; /* no constraint violation */
P[0]; /* constraint violation */