[cfe-commits] r136161 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp

John McCall rjmccall at apple.com
Tue Jul 26 23:14:50 PDT 2011


On Jul 26, 2011, at 11:03 PM, John McCall wrote:

> On Jul 26, 2011, at 9:54 PM, Douglas Gregor wrote:
>> On Jul 26, 2011, at 3:34 PM, Eli Friedman wrote:
>>> On Tue, Jul 26, 2011 at 3:28 PM, Sean Hunt <scshunt at csclub.uwaterloo.ca> wrote:
>>>> On Tue, Jul 26, 2011 at 15:25, Eli Friedman <eli.friedman at gmail.com> wrote:
>>>>> Author: efriedma
>>>>> Date: Tue Jul 26 17:25:31 2011
>>>>> New Revision: 136161
>>>>> 
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=136161&view=rev
>>>>> Log:
>>>>> A couple minor issues with Sema for delete:
>>>>> 
>>>>> 1. Attempting to delete an expression of incomplete class type should be an error, not a warning.
>>>>> 
>>>>> 2. If someone tries to delete a pointer to an incomplete class type, make sure we actually emit
>>>>> the delete expression after we warn.
>>>> 
>>>> Deleting an object of incomplete class type is well-formed;
>>>> [expr.delete]/5. This should not be an error.
>>> 
>>> [expr.delete]/1: "The operand shall have a pointer to object type, or
>>> a class type having a single non-explicit conversion function (12.3.2)
>>> to a pointer to object type."  An expression of incomplete class type
>>> isn't either of those.
>> 
>> 
>> An incomplete class type is an object type in C++.
> 
> But it's not a pointer to object type.  The "object being deleted" per [expr.delete]p1

Er, that is, per [expr.delete]p5.  And p2, for that matter.

I think we're supposed to interpret "the operand" in p6 and p7 as already having undergone conversion, which gives "the operand" meaning the pointer and "the object" meaning the object to which the operand points if it's non-null.

This could be much more precisely drafted, but if one reads it with one's eyes always fixed on intent, it seems obvious enough.

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110726/0a61c4b2/attachment.html>


More information about the cfe-commits mailing list