On Aug 12, 2009, at 6:17 PM, Ryan Flynn wrote:

> On Wed, Aug 12, 2009 at 7:56 PM, Eli  
> Friedman<[email protected]> wrote:
>> On Wed, Aug 12, 2009 at 4:53 PM, Ryan Flynn<[email protected]>  
>> wrote:
>>> On Wed, Aug 12, 2009 at 7:49 PM, Eli  
>>> Friedman<[email protected]> wrote:
>>>> On Wed, Aug 12, 2009 at 4:36 PM, Ryan Flynn<[email protected]>  
>>>> wrote:
>>>>> --- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
>>>>> +++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Wed Aug 12 18:36:28 2009
>>>>> @@ -437,7 +437,7 @@
>>>>>     return;
>>>>>   }
>>>>>
>>>>> -  if (FunctionDecl *FD = dyn_cast<FunctionDecl>(d)) {
>>>>> +  if (FunctionDecl *FD = cast<FunctionDecl>(d)) {
>>>>>     if (!FD->getResultType()->isPointerType()) {
>>>>>       S.Diag(Attr.getLoc(),  
>>>>> diag::warn_attribute_malloc_pointer_only);
>>>>>       return;
>>>>
>>>> Is there actually any guarantee the decl in question is a  
>>>> function decl?
>>>>
>>>> -Eli
>>>>
>>>
>>> Eli,
>>>
>>> The block above it returns if (!isFunctionOrMethod(d)).
>>>
>>> Ryan
>>
>> But that doesn't guarantee it's a FunctionDecl, no?
>>
>> -Eli
>>
>
> Eli,
>
> Nope.

Ok, so getting back to cast vs dyncast, we need to do the "must be a  
pointer return type" check for the othe case as well :)

-Chris

_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to