[cfe-commits] r136172 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Eli Friedman
eli.friedman at gmail.com
Thu Jul 28 14:10:39 PDT 2011
On Thu, Jul 28, 2011 at 1:22 AM, Sebastian Redl
<sebastian.redl at getdesigned.at> wrote:
> On 27.07.2011 00:50, Eli Friedman wrote:
>> Author: efriedma
>> Date: Tue Jul 26 17:50:18 2011
>> New Revision: 136172
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=136172&view=rev
>> Log:
>> Diagnose trying to delete a pointer to an abstract class with a non-virtual destructor. PR10504.
>>
>> I'm not completely sure the standard allows us to reject this, but if it doesn't, it should. :)
>>
> It's undefined behavior, but only if that code path is ever reached.
> I wish C++ would allow compilers to reject a program if any single
> function is provably always undefined, but unfortunately it doesn't -
> we'd have to prove that this function will be called in every possible
> program execution as well.
>
> Might be interesting as a compiler flag, though.
Maybe... being able to write undefined operations can be convenient in
macros/templates/etc, though.
Note that I changed this in a subsequent commit to downgrade it to a
warning (which is on by default).
-Eli
More information about the cfe-commits
mailing list