Authors: Joseph Myers
Date: 2026-05-15
Submitted against: C23
Status: Open
Cross-references: 1013
There are three ways in which a function parameter can be given variably modified type (before adjustment of parameter arrays to pointers): an array declarator specifying a length that is not an integer constant expression; declaration specifiers containing a typedef name for a variably modified type; declaration specifiers containing a typeof specifier for a variably modified type.
When the function declarator is used in a type name or a declaration
that is not a definition of that function, the length in the first
case is treated as replaced by *. In the second case, of a typedef
name (only possible inside a function), issue 1013
question 5 suggests the replacement should occur as well, for the
purposes of determining the "same type" property.
In the third case, of a typeof specifier, it would be natural to apply such replacement as well when determining the type, but simply changing the type to one of unspecified length is not sufficient to resolve questions around the evaluation of the operand of the typeof specifier. Consider the code:
int x;
void f(typeof(++x, (int (*)[x])0));
If the change to an array of unspecified length is applied, the
parameter's type is int (*)[*]. But this does not address what
happens to the evaluation of the ++x part of the operand of
typeof. When the above code occurs at file scope, there should not
be such an evaluation because there is no meaningful point at which
such evaluation could occur; in turn, that means there should be no
evaluation at block scope either. But this would require wording for
replacing lengths by * to say something about not evaluating the
operand of a typeof specifier in the declaration specifiers for the
function parameter. (The exact wording for C2Y might depend on the
adoption of the "discarded" proposal.)