[cfe-dev] is delete on abstract with non-virtal ever safe?

Richard Smith richard at metafoo.co.uk
Mon Oct 7 15:40:10 PDT 2013


On Sat, Oct 5, 2013 at 10:21 AM, emmanuel.attia
<emmanuel.attia at philips.com>wrote:

> I agree that the 5.3.5 rule is contradictory into what I do, but
> introduction
> of chap 5 states:
>
> "2. Operators can be overloaded, that is, given meaning when applied to
> expressions of class type (clause 9) or enumeration type (7.2). Uses of
> overloaded operators are transformed into function calls as described in
> 13.5. Overloaded operators obey the rules for syntax specified in clause 5,
> but the requirements of operand  type, lvalue, and evaluation order are
> replaced by the rules for function call."
>
> So is 5.3.5 really a requirement of any delete operator or only of the
> default one ?
>

13.5/5:

The allocation and deallocation functions, operator new, operator new[],
operator delete and operator
delete[], are described completely in 3.7.4. The attributes and
restrictions found in the rest of this
subclause do not apply to them unless explicitly stated in 3.7.4.


> For the default delete operator since the behavior is to free the memory it
> would make sense to require the destructor of the object to be callable by
> putting a virtual destructor in the base interface.
>
>
>
> --
> View this message in context:
> http://clang-developers.42468.n3.nabble.com/is-delete-on-abstract-with-non-virtal-ever-safe-tp4025653p4034904.html
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20131007/8e637e52/attachment.html>


More information about the cfe-dev mailing list