cfunctionlvalue

Is an lvalue of a function type a modifiable lvalue or not?


6.3.2.1 Lvalues, arrays, and function designators in the C11 standard says

A modifiable lvalue is an lvalue that does not have array type, does not have an incomplete type, does not have a const-qualified type, and if it is a structure or union, does not have any member (including, recursively, any member or element of all contained aggregates or unions) with a const-qualified type.

Is an lvalue of a function type a modifiable lvalue or not?

The quote doesn't mention function types, but in reality, I think an lvalue of a function type is not a modifiable lvalue. (lvalues of array types and lvalues of function types also share some similarity: both are converted to the addresses of arrays and of functions.)


Solution

  • Is an lvalue of a function type a modifiable lvalue or not?

    The question contains a misnomer. An lvalue by definition only designates an object. Earlier in the paragraph you cite (p1), it specifies

    An lvalue is an expression (with an object type other than void) that potentially designates an object;

    Functions aren't counted in the definition of objects, so there aren't lvalues of a function type.

    Instead, there's a separate category for function types. In section 6.3.2.1 as well, paragraph 4:

    A function designator is an expression that has function type. Except when it is the operand of the sizeof operator, the _Alignof operator, or the unary & operator, a function designator with type ''function returning type'' is converted to an expression that has type ''pointer to function returning type''.

    So the question is mostly moot. Expressions that specify things in terms of lvalues do not have to concern themselves about function types. Instead, if applicable, the specification for the expression will mention how it operates with a "function designator"

    I think an lvalue of a function type is not a modifiable lvalue

    Correct, but that is again on account of not being counted among lvalues at all.