Skip to content

[expr.add] p4 lacks to specify the case when the expression J has an unscoped enumeration type CWG1642 #5199

@xmh0511

Description

@xmh0511

[expr.add] p4 only specifies the calculation process for the case when J has an integral type and P has a pointer type

When an expression J that has integral type is added to or subtracted from an expression P of pointer type, the result has the type of P.

Since we admit that J can also have an unscoped enumeration type in [expr.add] p1 and [expr.add] p2. And, I think the usual arithmetic conversion is not applied to the case when J has an unscoped enumeration type and P has a pointer type. Should we augment [expr.add] p4 to be that?

When an expression J that has an integral type or unscoped enumeration type is added to or subtracted from an expression P of pointer type, the result has the type of P. If J has an unscoped enumeration type, the integral promotion conversion is performed on J, and the converted operand is used in place of the original operand for the remainder of this subclause.

  • [...]

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