Topic: delete expressions
Author: Michiel Salters<Michiel.Salters@cmg.nl>
Date: Fri, 18 May 2001 15:03:33 GMT Raw View
In article <3B035116.F1049626@wizard.net>, James Kuyper Jr. says...
>
>For delete expressions, 5.3.5p1 says "... The operand shall have a
>pointer type, or a class type having a single conversion function to a
>pointer type. ..."
>5.3.5p3 says "... if the static type of the operand is different from
>its dynamic type, the static type shall be a base class of the operand's
>dynamic type and the static type shall have a virtual destructor or the
>behavior is undefined."
>
>Unless I've misunderstood something, shouldn't 5.2.5p3 be referring to
>the static type pointed at by the operand, and the dynamic type of the
>object pointed at by the operand, rather than the static and dynamic
>types of the operand itself? The static type of a pointer cannot be a
>base class, it can only be a pointer to a base class.
>Furthermore, shouldn't it say "is not compatible with" rather than
>"different from"?
Good point. I don't see any recorded issues with this section, so it
warrants a DR submission. The operand type indeed must of pointer type,
5.3.5p2 talks about the operand being the null pointer. So 5.3.5p3
is not precise enough.
1.3.3 is also very clear. Pointers do not have dynamic types which differ
from their static types. What they point to might.
I don't get the "Furthermore," part. What is wrong with "different"?
I.e. what different but compatible types are allowed ?
Regards, Michiel Salters
--
Michiel Salters
Consultant Technical Software Engineering
CMG Trade, Transport & Industry
Michiel.Salters@cmg.nl
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]
Author: "James Kuyper Jr." <kuyper@wizard.net>
Date: Thu, 17 May 2001 11:33:06 GMT Raw View
For delete expressions, 5.3.5p1 says "... The operand shall have a
pointer type, or a class type having a single conversion function to a
pointer type. ..."
5.3.5p3 says "... if the static type of the operand is different from
its dynamic type, the static type shall be a base class of the operand's
dynamic type and the static type shall have a virtual destructor or the
behavior is undefined."
Unless I've misunderstood something, shouldn't 5.2.5p3 be referring to
the static type pointed at by the operand, and the dynamic type of the
object pointed at by the operand, rather than the static and dynamic
types of the operand itself? The static type of a pointer cannot be a
base class, it can only be a pointer to a base class.
Furthermore, shouldn't it say "is not compatible with" rather than
"different from"?
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html ]