Title
Pointer arithmetic after derived-base conversion
Status
cd3
Section
7.6.6 [expr.add]
Submitter
Loïc Joly

Created on 2012-05-20.00:00:00 last changed 90 months ago

Messages

Date: 2013-04-15.00:00:00

[Moved to DR at the April, 2013 meeting.]

Date: 2012-10-15.00:00:00

Proposed resolution (October, 2012):

Add the following as a new paragraph before 7.6.6 [expr.add] paragraph 7:

For addition or subtraction, if the expressions P or Q have type “pointer to cv T", where T is different from the cv-unqualified array element type, the behavior is undefined. [Note: In particular, a pointer to a base class cannot be used for pointer arithmetic when the array contains objects of a derived class type. —end note]

If the value 0 is added to or subtracted...

Date: 2012-05-20.00:00:00

The current wording is not sufficiently clear that a pointer to a base class subobject of an array element cannot be used in pointer arithmetic.

History
Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2013-10-14 00:00:00adminsetstatus: dr -> drwp
2013-05-03 00:00:00adminsetmessages: + msg4387
2013-05-03 00:00:00adminsetstatus: ready -> dr
2012-11-03 00:00:00adminsetmessages: + msg4051
2012-11-03 00:00:00adminsetstatus: open -> ready
2012-05-20 00:00:00admincreate