Skip to content

[expr] The clauses of some operators lack the specification of the type and value category of the result of the operator #960

Description

@xmh0511

Full name of submitter (unless configured in github; will be published with the issue): Jim X

In [intro.execution] p10, the rule says

The value computations of the operands of an operator are sequenced before the value computation of the result of the operator.

In [basic.lval] note1, the wording implies that the result of the operator is the result of the expression associated with the operator

For example, the built-in assignment operators expect that the left operand is an lvalue and that the right operand is a prvalue and yield an lvalue as the result.

However, in some operator clauses, we lack a specification of the result's type and value category. For example, [expr.add] p3

The result of the binary + operator is the sum of the operands. The result of the binary - operator is the difference resulting from the subtraction of the second operand from the first.

It didn't specify the value category of the result of the operator. By contrast, [expr.comma] explicitly specifies all of them

The type and value of the result are the type and value of the right operand; the result is of the same value category as its right operand, and is a bit-field if its right operand is a bit-field.

Suggested Resolution:

Explicitly specify type, value, and value category for all operators if the corresponding clauses miss the specification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions