[ub] Non-virtual destructor call
Andrzej Krzemienski
akrzemi1 at gmail.com
Fri Dec 13 16:28:50 CET 2013
2013/12/13 Ville Voutilainen <ville.voutilainen at gmail.com>
>
> Why don't you do
> std::function<void(T)>*fun = new std::function<void(T)>(Callback{});
> delete fun;
> instead? Apply auto* where necessary.
>
Well, it is not a real-life use. I do not have to solve this problem in any
of my projects. I had a hypothesis that "using veneers is safe", i.e. If I
derive from a type that does not have virtual functions but I do not add
any changes to the layout, it is a safe thing to do. It turns out that
5.3.5/3 makes it unsafe, but for no good reason.
Well, having rules simpler has merit, but it also prevents certain styles
of programming.
Regards,
&rzej
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.open-std.org/pipermail/ub/attachments/20131213/992b5474/attachment.html
More information about the ub
mailing list