Title
Adding/subtracting pointer and enumeration value
Status
nad
Section
7.6.6 [expr.add]
Submitter
Steve Adamczyk

Created on 1998-10-13.00:00:00 last changed 307 months ago

Messages

Date: 1999-04-15.00:00:00

Rationale (04/99): Paragraph 1 invokes "the usual arithmetic conversions" for operands of enumeration type.

(It was later pointed out that the builtin operator T* operator+(T*, ptrdiff_t) (12.5 [over.built] paragraph 13) is selected by overload resolution. Consequently, according to 12.2.2.3 [over.match.oper] paragraph 7, the operand of enumeration type is converted to ptrdiff_t before being interpreted according to the rules in 7.6.6 [expr.add] .)

Date: 2022-02-18.07:47:23

An expression of the form pointer + enum (see paragraph 5) is not given meaning, and ought to be, given that paragraph 2 of this section makes it valid. Presumably, the enum value should be converted to an integral value, and the rest of the processing done on that basis. Perhaps we want to invoke the integral promotions here.

[Should this apply to (pointer - enum) too?]

Rationale (04/99): Paragraph 1 invokes "the usual arithmetic conversions" for operands of enumeration type.

(It was later pointed out that the builtin operator T* operator+(T*, ptrdiff_t) (12.5 [over.built] paragraph 13) is selected by overload resolution. Consequently, according to 12.2.2.3 [over.match.oper] paragraph 7, the operand of enumeration type is converted to ptrdiff_t before being interpreted according to the rules in 7.6.6 [expr.add] .)

History
Date User Action Args
1999-09-14 00:00:00adminsetmessages: + msg192
1999-09-14 00:00:00adminsetstatus: open -> nad
1998-10-13 00:00:00admincreate